WINAPI β A preprocessor definition defined as __stdcall calling the convention; when functions have __stdcall before their name, it is a directive for the compiler to force this function to use this calling convention. This means that both your function and the function that calls your function agree to use the stdcall calling convention, and the call is executed correctly.
This is necessary because the default calling convention of your compiler may or may not be stdcall, so you need to explicitly tell the compiler to do this for this function. The Windows API designers have decided, mainly for reasons of compatibility and universality of the stdcall calling convention, that all function calls use the stdcall calling convention.
In addition, you can have functions with different calling conventions that are used in the same program. So, for example, WinMain should be stdcall, but other functions of your program are not executed; they can use the default compiler.
A calling convention is a method for performing actions such as the order in which the parameters should go on the stack, who should remove them from the stack when returning the function, where to put the return values ββand other things. Different calling conventions do this differently. First of all, it is extremely important that both the caller and the callee invoke the same calling convention. For more information about calls, see the Wikipedia article .
source share