在 2024-10-17 16:07, Ericxu833--- via Gcc 写道:
I used IDA pro to reverse engineer test.exe and found that gcc added "call __main" to the front of the assembly code, and then executed "jmp __do_global_ctors". I guess this code means to instantiate C++ objects.
Yes, mostly.
My code is pure C language and does not need this code. How to remove the extra assembly code.
The solution is to define `WinMain()` (or `wWinMain()` with the `-municode` option), where GCC will not insert `__main()`.
Note the call still exists, before your main function is called. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature