Posted this at a different site, posting here as well because I didn;t get any response there.
What kind of token is WINAPI, that appears before every Windows function. I know it stands for __stdcall, and I know about calling conventions. But I have never known C language to allow a calling convention descriptor to sit between the function name (WinMain) and the return type (int):
i.e. int WINAPI WinMain (...)
So how exactly does this work? I even had a look at the C99 specification but couldn't find anything similar there.
It's nothing special, just a pre-processor definition as part of the windows headers.
#define WINAPI __stdcall
It's for readability more than anything - CALLBACK and APIENTRY are exactly the same - it's simply code documentation.
How you specify the calling-convention depends on your compiler; since it's usually __cdecl there's rarely need to change it.
It's an extension. Standard C without extensions is practically unusable. Just look here http://msdn.microsoft.com/en-US/library/634ca0c2(v=VS.80).aspx and count the functions starting with an underscore, those functions are also non-standard (i.e. an extension).