Export (0) Print
Expand All

CALLCONV Enumeration

Identifies the calling convention used by a method described in a METHODDATA Data Type structure.

Namespace:  System.Runtime.InteropServices.ComTypes
Assembly:  mscorlib (in mscorlib.dll)

[<SerializableAttribute>]
type CALLCONV

Member nameDescription
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_CDECLIndicates that the C declaration (CDECL) calling convention is used for a method.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_MACPASCALIndicates that the Macintosh Pascal (MACPASCAL) calling convention is used for a method.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_MAXIndicates the end of the CALLCONV enumeration.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_MPWCDECLIndicates that the Macintosh Programmers' Workbench (MPW) CDECL calling convention is used for a method.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_MPWPASCALIndicates that the Macintosh Programmers' Workbench (MPW) PASCAL calling convention is used for a method.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_MSCPASCALIndicates that the MSC Pascal (MSCPASCAL) calling convention is used for a method.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_PASCALIndicates that the Pascal calling convention is used for a method.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_RESERVEDThis value is reserved for future use.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_STDCALLIndicates that the standard calling convention (STDCALL) is used for a method.
Supported by Portable Class LibrarySupported in .NET for Windows Store appsCC_SYSCALLIndicates that the standard SYSCALL calling convention is used for a method.

The calling conventions in this class describe how functions pass arguments and return values. They specify the order in which parameters are set up for the called functions, where the parameters are stored (in registers or in memory), and who (caller or called function) is responsible for cleaning up the stack after the function returns. For example:

  • CC_CDECL uses the naming and calling conventions of the C language. The caller pushes the parameters onto the stack in reverse (right-to-left) order, and cleans the stack after the function returns. This calling convention enables you to call functions with varargs, which makes it appropriate for use with methods that accept a variable number of parameters, such as the C run-time functions printf, _printf_l, wprintf, _wprintf_l.

  • CC_PASCAL uses the Pascal calling convention. The caller pushes the parameters onto the stack in left-to-right order. The called function cleans the stack before returning.

  • CC_STDCALL is the standard calling convention for Win32 functions. It is the default convention for calling unmanaged functions with platform invoke. The caller pushes the parameters onto the stack in reverse (right to left) order, and the called function cleans the stack before returning.

  • CC_SYSCALL is similar to CDECL in that arguments are pushed from right to left. The EAX, ECX, and EDX registers are not preserved.

These calling convention identifiers are used by the .NET Framework, the Windows Embedded CE platform, and by Automation.

For additional information about CALLCONV, see the MSDN Library.

The common language runtime throws an exception when a COM method in native code returns an HRESULT. For more information, see How to: Map HRESULTs and Exceptions.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1

Windows Phone 8.1, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft