开发者

About the signature: int WINAPI WinMain (HINSTANCE p1, HINSTANCE p2, LPSTR p3, int p4)

开发者 https://www.devze.com 2022-12-28 16:55 出处:网络
Why can WinMain have two return types? If I remove it,will report this warning: warning C4007: \'WinMain\' : must be \'__stdcall\'

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消