First, __ cdecl, c Declaration, and C style statement. Or C default calling ). (So the question is, why is the Pascal style called STD ?)
The call conventions include three points: the order of parameters in and out of the stack, who is responsible for the stack play, and the method for generating the function name (renaming ?)
1.
In the parameter stack order, the difference between __cdecl and _ stdcall is from right to left;
2.
_ Cdecl is the default value of C/C ++. Let's recall the variable-length parameter function like printf in STL. Only the caller can know the real parameter, therefore, it is more appropriate for the caller to recover the stack.
The conclusion is that __cdecl specifies that the caller is responsible for the stack.
Go down ......
The caller is responsible for the stack, which means that in the final executable code, all the calls to the method specified as _ cdecl will generate a piece of code to clean the stack relative to _ stdcall.
In other words, if a Windows API acts as an existing system/binary code/or something else, when it calls a function provided by an application, there is no way to know how to clean up the stack (callback/winapi) provided by programmers,
It is even more difficult to add the code for processing stacks to this set of existing "system/binary code/or anything else". Therefore, the function provider must process stacks on its own.
This is why callback/winapi is _ stdcall.
3.
.
Call conventions _ cdecl and _ stdcall