what does WINAPI stand for

前端 未结 3 1663
醉梦人生
醉梦人生 2020-12-09 05:38

I\'ve started to learn Win32 API in C. I saw that the main function is something like

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR          


        
3条回答
  •  萌比男神i
    2020-12-09 06:00

    It's specifying the calling convention, which is how arguments to functions are placed and managed on the stack.

    You can mix calling conventions, say if you're calling some external code, like windows APIs, as long as everyone is on the same "page" with their expectations.

    Typical c calls are compiled using what's known as cdecl. In cdecl the caller cleans up the arguments pushed on the stack.

    WINAPI, also known as "standard call" means that the called function is responsible for cleaning up the stack of its arguments.

    The MS compiler will prefix a cdecl call with a _, while a WINAPI gets a leading _ and gets an @{BYTES-NEEDED} prepended to the function name when it mangles the function names. From the link above:

    call        _sumExample@8  ;WINAPI
    call        _someExample   ;cdecl
    

提交回复
热议问题