+2007-06-11 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * crt1.c (__mingw_CRTStartup): Add explicit call to gcc's __main.
+
2007-05-08 Danny Smith <dannysmith@users.sourceforge.net>
* include/stdint.h (intptr_t): Fix typo.
#include "init.c"
#include "cpu_features.h"
+extern void __main ();
extern void _pei386_runtime_relocator (void);
extern int main (int, char **, char **);
or in functions inlined into main. */
asm __volatile__ ("andl $-16, %%esp" : : : "%esp");
+ /* From libgcc.a, __main calls global class constructors via
+ __do_global_ctors, This in turn registers __do_global_dtors
+ as the first entry of the app's atexit table. We do this
+ explicitly at app startup rather than rely on gcc to generate
+ the call in main's prologue, since main may be imported from a dll
+ which has its own __do_global_ctors. */
+ __main ();
+
/*
* Call the main function. If the user does not supply one
* the one in the 'libmingw32.a' library will be linked in, and