Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə27/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   23   24   25   26   27   28   29   30   ...   294
DelphiLanguageGuide

The Finalization Section
The finalization section is optional and can appear only in units that have an initialization section. The finalization
section begins with the reserved word finalization and continues until the end of the unit. It contains statements that
are executed when the main program terminates (unless the Halt procedure is used to terminate the program). Use
the finalization section to free resources that are allocated in the initialization section.
Finalization sections are executed in the opposite order from initialization sections. For example, if your application
initializes units A, B, and C, in that order, it will finalize them in the order C, B, and A.
Once a unit's initialization code starts to execute, the corresponding finalization section is guaranteed to execute
when the application shuts down. The finalization section must therefore be able to handle incompletely initialized
data, since, if a runtime error occurs, the initialization code might not execute completely.
Note:
The initialization and finalization sections behave differently when code is compiled for the managed .NET
environment. See the chapter on Memory Management for more information.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   23   24   25   26   27   28   29   30   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin