About the signature: int WINAPI WinMain (HINSTANCE p1, HINSTANCE p2, LPSTR p3, int p4)
Why can WinMain
have two return types?
If I remove it,will report this warning:
warning C4007: 'WinMain' : must be '__stdcall'
Or I'm reading int WINAPI
wrongly?
UPDATE
I tried these two variants which are said to be the same as WINAPI
,none work:
int __declspec WinMain
int __declspec(stdc开发者_如何学JAVAall) WinMain
WINAPI
isn't a return type it's a macro expanding to an implementation specific decoration or attribute for the function. In this instance it specifies the calling convention and is equivalent to __stdcall
.
Grammatically, WINAPI is roughly (but not exactly) equivalent to a storage class specifier like static
.
WINAPI
is not a second return value, but a #define
for __stdcall
.
__stdcall is a calling convention, that handles amongst others how the parameters are given to the function.
精彩评论