System.Runtime.InteropServices.CallingConvention Enum

public enum CallingConvention

Base Types

Object
  ValueType
    Enum
      CallingConvention

Assembly

mscorlib

Library

RuntimeInfrastructure

Summary

Indicates the calling convention used by a method located in an unmanaged shared library.

Description

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 CallingConvention enumeration, see the DllImportAttribute class overview.]

See Also

System.Runtime.InteropServices Namespace

Members

CallingConvention Fields

CallingConvention.Cdecl Field
CallingConvention.FastCall Field
CallingConvention.StdCall Field
CallingConvention.ThisCall Field
CallingConvention.value__ Field


CallingConvention.Cdecl Field

Cdecl = 2;

Summary

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

For example, on a Windows platform the System.Runtime.InteropServices.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.]

See Also

System.Runtime.InteropServices.CallingConvention Enum, System.Runtime.InteropServices Namespace

CallingConvention.FastCall Field

FastCall = 5;

Summary

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.]

See Also

System.Runtime.InteropServices.CallingConvention Enum, System.Runtime.InteropServices Namespace

CallingConvention.StdCall Field

StdCall = 3;

Summary

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

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

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

See Also

System.Runtime.InteropServices.CallingConvention Enum, System.Runtime.InteropServices Namespace

CallingConvention.ThisCall Field

ThisCall = 4;

Summary

Indicates that the thiscall calling convention is appropriate for a method. This convention is similar to the System.Runtime.InteropServices.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 System.Runtime.InteropServices.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.]

See Also

System.Runtime.InteropServices.CallingConvention Enum, System.Runtime.InteropServices Namespace

CallingConvention.value__ Field

value__;

See Also

System.Runtime.InteropServices.CallingConvention Enum, System.Runtime.InteropServices Namespace