Mono Class Library: System.Runtime.InteropServices Namespace

System.Runtime.InteropServices.CallingConvention Enumeration

Indicates the calling convention used by a method located in an unmanaged shared library.
[System.Runtime.InteropServices.ComVisible(true)]
public enum CallingConvention

Remarks

The values of this enumeration are used to specify the calling conventions required to call unmanaged methods implemented in shared libraries.

Note: Implementers should map the semantics of specified calling conventions onto the calling conventions of the host OS.

Note: For additional information on shared libraries and an example of the use of the System.Runtime.InteropServices.CallingConvention enumeration, see the System.Runtime.InteropServices.DllImportAttribute class overview.

Members

Member NameDescription
Cdecl

Indicates that the cdecl calling convention is appropriate for a method call.

For example, on a Windows platform the CallingConvention.Cdecl convention produces the following behavior:

ElementBehavior
Argument-passing orderRight to left.
Stack-maintenance responsibilityCalling function pops the arguments from the stack.

Note: This is the default calling convention for functions compiled with 32-bit C and C++ language compilers.

FastCall

Indicates that the fastcall calling convention is appropriate for a method call.

Note: On a Windows platform this convention indicates that arguments to functions are to be passed in registers whenever possible.

StdCall

Indicates that the stdcall calling convention is appropriate for a method.

For example, on a Windows platform the CallingConvention.StdCall convention produces the following behavior:

ElementBehavior
Argument-passing orderRight to left.
Stack-maintenance responsibilityCalled function pops its own arguments from the stack.
ThisCall

Indicates that the thiscall calling convention is appropriate for a method. This convention is similar to the CallingConvention.Cdecl calling convention, except that the last element that the caller pushes the stack is the this pointer.

For example, on a Windows platform the CallingConvention.ThisCall convention produces the following behavior:

ElementBehavior
Argument-passing orderRight to left.
Stack-maintenance responsibilityCalling function pops the arguments from the stack.
this pointerPushed last onto the stack.

Note: The thiscall calling convention is the default calling convention used by C++ member functions that are not called with a variable number of arguments.

WinapiDocumentation for this section has not yet been entered.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0