calling convention (calling convention), determines the following:
A. The stacking order of the function parameters.
B. The arguments are popped by the caller or by the caller.
C. And the method that produces the function decorated name.
Common calling conventions are __stdcall,__cdecl,__fastcall.
1) __stdcall.
Standardcall 's abbreviation, agreed content:
A. Parameters are pressed from right to left onto the stack.
B. The function is called by the caller to modify the stack.
C. The output function name is preceded by an underscore prefix, followed by an "@" symbol and the number of bytes of its parameters, in the format [email protected], For example: function (int a, int b)with the decorated name:[email protected]
Typically used in the Win32 Api , primarily in Microsoft Visual c,C + +.
Corresponding macro definition: #define WINAPI __stdcall
2) __cdecl.
C Declaration 's abbreviation, agreed content:
A. Parameters are stacked from right to left.
B. Caller cleanup stack, commonly known as manual clearing stack.
C. The output function name is preceded by an underscore prefix, formatted as _functionname.
The __cdecl is the default function call method for C + + languages.
3) __fastcall.
To increase the call speed, the first two (or several) parameters are passed by the register, and the remaining parameters are passed through the stack.
Quick call, contract content:
A. Parameters are pressed from right to left onto the stack.
B. The function is called by the caller to modify the stack.
C. The output function name is preceded by an "@" symbol, followed by an "@" symbol and the number of bytes of its parameter, in the format @[email protected] .
Different compiler-compiled programs stipulate different registers. On the Intel x86 platform, use the ECX and EDX registers. You cannot use the __fastcall method as a cross-compiler interface.
Summary of C + + technical issues-what is the 13th calling convention and what is different