• Advertisement
Sign in to follow this  

Win32 Return Types

This topic is 4043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've noticed that some Win32 functions seem to have two return types, like: int WINAPI WinMain... and LRESULT CALLBACK WinProc... I'm pretty sure that the second "return types" aren't really return types, but if they're not, what are they? I've never seen two words preceding a function name outside of Win32.

Share this post


Link to post
Share on other sites
Advertisement
The return types of those functions are int and LRESULT, respectively.
The 'keywords' WINAPI and CALLBACK indicate the calling convention used. The calling conventions describes how arguments are placed on the stack, and which registers of the CPU must be preserved.(More info: Wikipedia: x86 calling conventions). Note that WINAPI and CALLBACK actually are #defines for (OTOH) __stdcall and __cdecl.

Share this post


Link to post
Share on other sites
CALLBACK, WINAPI, PASCAL, and probably a few more that I cant remember right now are all #defined as __stdcall. None of them are #defined as __cdecl.

Share this post


Link to post
Share on other sites
Yep, you must be right. I took out the "WINAPI", and it gave me warnings about how WinMain had to be _stdcall.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement