Mail Archives: djgpp/1999/02/16/07:53:27
On Tue, 16 Feb 1999, Laurynas Biveinis wrote:
> How can I specify some function to be called before function main?
Declare the functions with __attribute__((constructor)). For example:
static void __attribute__((constructor)) my_startup (void)
{
/* put here your code */
}
Note that if you have several such functions, the order in which they are
called is unpredictable (it's the order in which the linker sees them,
and you have no real control on that).
- Raw text -