<<< C-style Procedure Call Example     Index     PASCAL-style Procedure Stack Maintenance >>>

9. Calling Conventions Summary

Calling Convention Argument Passing Stack Maintenance Name Decoration Notes
__cdecl Right to left. Caller removes arguments from the stack. This calling convention is the only one that allows variable argument lists. Underscore prefixed to function names, as in _Foo. C convention. The default for C and C++ functions.
__stdcall Right to left. Callee removes its own arguments from the stack. Underscore prefixed to function name, and @ appended followed by the decimal number of bytes in the argument list, as in _Foo@12. Standard call. Used by almost all system functions; the default for Visual Basic internal functions.
pascal Left to right. Callee removes its own arguments from the stack. Undecorated symbol name in uppercase letters, as in FOO. The convention adopted in Pascal.
__fastcall First three DWORD parameters are passed in EAX, EDX, and ECX. If these registers are not sufficient for passing all parameters, then the remaining parameters are passed on the stack, right to left. Callee removes its own arguments from the stack. An @ is prefixed to the name, and @ is appended followed by the number of decimal bytes in the argument list, as in @Foo@12. Aka register, or fast calling convention. Applies only to Intel CPUs. This calling convention is the default for Borland Delphi compilers.
this Right to left. The this parameter is passed in the ECX register. Caller removes arguments from the stack. None. Used automatically by C++ class methods unless you specify standard call. COM methods are declared as standard call.
naked Right to left. Caller removes arguments from the stack. None. Used when you need custom prolog and epilog.

<<< C-style Procedure Call Example     Index     PASCAL-style Procedure Stack Maintenance >>>