Monday, 15 July 2013

delphi - Where and When is Application (TApplication) instance created? -



delphi - Where and When is Application (TApplication) instance created? -

where , when application instance created? (same goes screen instance) .

i don't see in forms or system initialization section. in cpu windows before application.initialize, see phone call @_initexe (sysinit) - leads _startexe (system) , whole lot of asm code - not create application instance far can tell.

what missing here?

it's easy plenty work out code. text search tapplication.create. illustration using ide's find in files feature.

but can lazy , debugger it.

enable debug dcus. set breakpoint in tapplication.create. run.

when programme breaks, @ phone call stack. see tapplication object instantiated initcontrols in controls unit. , initcontrols called initialization section of controls unit.

the total phone call stack plain vanilla vcl app looks this:

vcl.forms.tapplication.create(nil) vcl.controls.initcontrols vcl.controls.vcl.controls system.initunits system._startexe(???,???) sysinit._initexe($5a81bc) project1.project1 :749933aa kernel32.basethreadinitthunk + 0x12 :76f09ef2 ntdll.rtlinitializeexceptionchain + 0x63 :76f09ec5 ntdll.rtlinitializeexceptionchain + 0x36

doing same thing tscreen.create, see tscreen object instantiated in initcontrols().

i won't seek , explain of this. think there's plenty info , advice here work out here. although phone call stack xe3 application, same delphi 5 application.

delphi debugging initialization delphi-5

No comments:

Post a Comment