From Free Pascal wiki
Jump to: navigation, search

Initialization is the process by which an application sets the value of various internal variables, structures, tables, and other constructs which are used by the run-time library ("RTL"), or the operating system.

Initialization and startup are two very similar practices, with the difference being that initialization is presumed to be the setting of values and data necessary for any program of any kind to start, while startup is the actions perfomed once a particular program is initialized.

For example, a run-time library may need to obtain memory for internal buffers, file handles (as used by the Input and Output standard files), window handles in a Graphical User Interface, and other system resources. It may also, depending upon the operating system, load the user program or connect to shared libraries. It would, at that time, startup and transfer control to the user program, which would, itself, perform its own initialization.

The difference between initialization and startup is that, in general, initialization is where a program sets up internal constants, tables and resources that are necessary for the program to operate, and without which, the program simply cannot continue.

Startup would be the point at which an application is fully initialized, all the things that it needs to do only once have been done, and it essentially is ready to perform some work related to the problem definition that the application is intended to solve. Startup may also include non-initialization matters that need to be performed at the beginning of execution of an application.

The main difference being that if a part of the startup of any program fails, the particular program should still continue to work, albeit possibly with degraded performance, while if initialization fails, the program cannot continue.

Reserved word in unit

initialization is also a reserved word within Object Pascal. It starts the initialization part of a unit end is terminated with end or an optional finalization part of the unit.