Always use the System.Runtime.InteropServices.CallingConvention enumeration rather than the System.Runtime.InteropServices.CALLCONV enumeration to specify a calling convention in managed code. The latter exists only for the sake of COM definitions. The System.Runtime.InteropServices.CallingConvention enumeration is used by System.Runtime.InteropServices.DllImportAttribute and several classes in System.Reflection.Emit to dynamically emit platform invoke signatures.
Member Name | Description |
---|---|
Cdecl |
The caller cleans the stack. This enables calling functions with varargs, which makes it appropriate to use for methods that accept a variable number of parameters, such as Printf. |
FastCall |
This calling convention is not supported. |
StdCall |
The callee cleans the stack. This is the default convention for calling unmanaged functions with platform invoke. |
ThisCall |
The first parameter is the this pointer and is stored in register ECX. Other parameters are pushed on the stack. This calling convention is used to call methods on classes exported from an unmanaged DLL. |
Winapi |
This member is not actually a calling convention, but instead uses the default platform calling convention. For example, on Windows the default is CallingConvention.StdCall and on Windows CE.NET it is CallingConvention.Cdecl. |