Initial

xiaoxiao2021-03-06  45

_CDECL

Pressing parameters from right to left, pops up the argument by the caller. For "C" functions or variables, the modifier is in front of the function name. For the "C " function, it is different.

If the modulation of the function void test (void) is _TEST; for the "C " global function that does not belong to a class, the modifier name is? Test @@ zaxxz.

This is an MFC default call convention. Since the caller is responsible for popping the argument, you can define a number of non-number parameters, such as the Printf function.

_stdcall

Pressing the parameters from right to left, and pops up the argument by the caller. For "C" functions or variables, the modulation name is prefixed, then the function name, then the number of the symbol "@" and parameters, such as the function INT FUNC (Int A, Double B) is _func @ 12. The "C " function is different.

All Win32 API functions follow this agreement.

_fastcall

Two DWORD types or parameters accounting for less bytes are placed in ECX and EDX registers, and the other remaining parameters are pressed into the stack from right to left. By popping the parameters by the caller, the "C" function or variable, the modulation name is prefixed in "@", then the function name, then the number of the symbol "@" and parameters, such as the function int func (int A, Double B) is called @ func @ 12. For the "C " function, it is different.

Future compilers may use different registers to store parameters.

Thiscall

It is only applied to the "C " member function. The THIS pointer is stored in the CX register, the parameter is placed from right to left. Thiscall is not a keyword, so it cannot be designated by the programmer.

Naked Call

When using 1-4 call conventions, if necessary, the compiler generates code to save the ESI, EDI, EBX, EBP registers, generate code recovery of these registers when the compiler generates code. Naked Call does not produce such a code.

Naked Call is not a type modifier, so it must be used together with _Declspec, as follows:

__DECLSPEC (Naked) int func (formal_parameters)

{

// Function Body

}

转载请注明原文地址:https://www.9cbs.com/read-53057.html

New Post(0)