Date: Tue, 16 Feb 1999 14:49:11 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Laurynas Biveinis cc: djgpp AT delorie DOT com Subject: Re: Defining startup functions with djgpp In-Reply-To: <199902161153.GAA27025@delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com 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).