Based on my understanding, name mangling is used when there is function overloading, so that the functions with the same name can be distinguished.
But I have noticed that name mangling is also used with the WinMain() function (which is not overloaded). After name mangling it becomes _WinMain@16.
So why is name mangling used with the WinMain() function?
This is the code that I used:
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
return 0;
}
WinMainsymbol, it would be something completely different from what you see. What you see is the compiler having special treatment of theWinMainsymbol. - Some programmer dude_WinMain@16is some internal name used by the mingw/gcc compiler. What the 16 is supposed to mean, I have no idea. - Lundin@meansstdcallcalling convention, the16is the size of the parameter list (here: 4 times a 4 bytes argument). Functions using other calling conventions are decorated differently. - user2371524foowill have to use some manner of name mangling - highly implementation-defined. - Lundin