Calling conventions Directive Parameter order Clean-up Passes parameters in registers? register Left-to-right
Routine
Yes
pascal Left-to-right
Routine
No
cdecl Right-to-left
Caller
No
stdcall Right-to-left
Routine
No
safecall Right-to-left
Routine
No
The default register convention is the most efficient, since it usually avoids creation of a stack frame. (Access
methods for published properties must use register.) The cdecl convention is useful when you call functions from
shared libraries written in C or C++, while stdcall and safecall are recommended, in general, for calls to external
code. On Win32, the operating system APIs are stdcall and safecall. Other operating systems generally use cdecl.
(Note that stdcall is more efficient than cdecl.)
The safecall convention must be used for declaring dual-interface methods. The pascal convention is maintained
for backward compatibility.
The directives near, far, and export refer to calling conventions in 16-bit Windows programming. They have no effect
in Win32, or in .NET applications and are maintained for backward compatibility only.
113