Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-02

initiliazation, finalization and AddExitProc

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frank Church

I want to implement the SetHeapTraceOutput routine mentioned in this thread - http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-December/069226.html

I also want to do it in a tidy manner, perhaps create some kind of application template which contains it, and I think it should be in the finalization sections of the application or something like that, probably with the use of AddExitProc.

How would it all hang together? Are the initialization and finalization sections in a unit run when the program starts, or are they run when something in the unit is created?
eg if a form is not created automatically by the application would its initialization section be run at the state of the program regardless of whether something defined is used, and woulld that also apply to its finalization section?

Frank Church ======================= http://devblog.brahmancreations.com

Reply by email

Mattias Gaertner
to Frank Church
Show quoted text 11 lines
I want to implement the SetHeapTraceOutput routine mentioned in this thread - http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-December/069226.html I also want to do it in a tidy manner, perhaps create some kind of application template which contains it, and I think it should be in the finalization sections of the application or something like that, probably with the use of AddExitProc. How would it all hang together? Are the initialization and finalization sections in a unit run when the program starts, or are they run when something in the unit is created?

When program starts, before main program 'begin'.

eg if a form is not created automatically by the application would its initialization section be run at the state of the program regardless of whether something defined is used, and woulld that also apply to its finalization section?

Mattias

Reply by email

Frank Church
to Mattias Gaertner
Mattias Gaertner wrote 30 lines
On Fri, 8 Feb 2013 12:42:53 +0000 Frank Church wrote: > I want to implement the SetHeapTraceOutput routine mentioned in this > thread - http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-December/069226.html > > I also want to do it in a tidy manner, perhaps create some kind of > application template which contains it, and I think it should be in > the finalization sections of the application or something like that, > probably with the use of AddExitProc. > > How would it all hang together? Are the initialization and > finalization sections in a unit run when the program starts, or are > they run when something in the unit is created? When program starts, before main program 'begin'. > eg if a form is not created automatically by the application would its > initialization section be run at the state of the program regardless > of whether something defined is used, and woulld that also apply to > its finalization section? Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

How about AddExitProc - can you add multiple exit procedures and set the order of their execution or is it a FIFO or LIFO order?

Frank Church ======================= http://devblog.brahmancreations.com

Reply by email

Michael Van Canneyt
to Frank Church
Frank Church wrote 34 lines
On 8 February 2013 12:45, Mattias Gaertner wrote: > On Fri, 8 Feb 2013 12:42:53 +0000 > Frank Church wrote: > >> I want to implement the SetHeapTraceOutput routine mentioned in this >> thread - http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-December/069226.html >> >> I also want to do it in a tidy manner, perhaps create some kind of >> application template which contains it, and I think it should be in >> the finalization sections of the application or something like that, >> probably with the use of AddExitProc. >> >> How would it all hang together? Are the initialization and >> finalization sections in a unit run when the program starts, or are >> they run when something in the unit is created? > > When program starts, before main program 'begin'. > >> eg if a form is not created automatically by the application would its >> initialization section be run at the state of the program regardless >> of whether something defined is used, and woulld that also apply to >> its finalization section? > > > Mattias > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus How about AddExitProc - can you add multiple exit procedures and set the order of their execution or is it a FIFO or LIFO order?

You can add multiple exit procedures. They are executed LIFO. (in general, it is best not to make too much assumptions about the order)

Michael.

Reply by email