RAD Studio
#pragma exit and #pragma startup


#pragma startup function-name <priority>
#pragma exit function-name <priority>


These two pragmas allow the program to specify function(s) that should be called either upon program startup (before the main function is called), or program exit (just before the program terminates through _exit). 

The specified function-name must be a previously declared function taking no arguments and returning void; in other words, it should be declared as:

void func(void);

The optional priority parameter should be an integer in the range 64 to 255. The highest priority is 0. Functions with higher priorities are called first at startup and last at exit. If you don't specify a priority, it defaults to 100.

Warning: Do not use priority values less than 64. Priorities from 0 to 63 are reserved for ISO startup and shutdown mechanisms.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!