In a system integration project, encountered a typedef int (__stdcall *func_*****_system_version) (), such a statement, the first contact with _stacall, so the collation is as follows:
Reprint: http://blog.csdn.net/u4110122855/article/details/8266725
Not all languages support _cdcel call rules, but all support _sdtcall call rules, if you use VC to do a DLL, export some functions, if you want this DLL by other languages can also call, VB. Dephi. PB.. Your calling convention as the __stdcallwindows API is _stdcall calling rules,
The function call convention determines how a program implements a function call and how arguments are passed. In a single language program, the calling convention is almost always correct because there is always a default convention for all modules and the header file is responsible for the consistency between the invocation and the invoked program. In a mixed-language program, different languages cannot share the same header file. Errors resulting from the calling convention cannot be discovered at compile time until the program is implemented at run time (run-time) to implement a function call and will immediately cause the application to crash.
Key stack's maintainer parameter pass
__cdecl caller parameter reverse sequence into stack (right-> left)
__stdcall The callee parameter back into the stack (right-> left)
__fastcall the caller parameter to the register, and then into the stack
The thiscall (not the keyword) is called into the stack by the caller parameter, this pointer is stored ECX
In C + +, you can specify the calling convention with the keyword __stdcall when the function is declared or defined. __stdcall calling conventions are often used in Windows programs or API functions. In GUI programs, PASCAL, WINAPI, and callback are all defined as __stdcall. The default calling convention for the C language is __cdecl.
__stdcall's name modification is to underline the first sign (_) and then add the "@" and function parameter bytes (required stack space)