[Lazarus] initiliazation, finalization and AddExitProc

Michael Van Canneyt michael at freepascal.org
Fri Feb 8 14:20:18 CET 2013



On Fri, 8 Feb 2013, Frank Church wrote:

> On 8 February 2013 12:45, Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
>> On Fri, 8 Feb 2013 12:42:53 +0000
>> Frank Church <vfclists at gmail.com> 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
>> Lazarus at lists.lazarus.freepascal.org
>> 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.




More information about the Lazarus mailing list