crt: exe: Invoke gcc c++ constructors after msvc c++ constructors Function __main() is function for executing gcc c++ constructors. Move it into guarded code which prevents duplicate code execution, after executing msvc c++ constructors (__xc_a-__xc_z callbacks). Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c index 0f79c0a..00221ea 100644 --- a/mingw-w64-crt/crt/crtexe.c +++ b/mingw-w64-crt/crt/crtexe.c
@@ -216,6 +216,7 @@ _amsg_exit (8); /* _RT_SPACEARG */ _initterm (__xc_a, __xc_z); + __main (); /* C++ initialization. */ __native_startup_state = __initialized; } @@ -228,7 +229,6 @@ __dyn_tls_init_callback (NULL, DLL_THREAD_ATTACH, NULL); duplicate_ppstrings (argc, &argv); - __main (); /* C++ initialization. */ #ifdef _UNICODE __winitenv = envp; #else