[Solved] How mingw32-g++ compiler know where to inject system calls in the WIN32 machine executable?


To quote the gcc manual:

If no init section is available, when GCC compiles any function called
main (or more accurately, any function designated as a program entry
point by the language front end calling expand_main_function), it
inserts a procedure call to __main as the first executable code after
the function prologue. The __main function is defined in libgcc2.c and
runs the global constructors.

1

solved How mingw32-g++ compiler know where to inject system calls in the WIN32 machine executable?