CALLCONV CALLCONV CALLCONV CALLCONV Enum

定义

标识 METHODDATA 结构中描述的方法所使用的调用约定。Identifies the calling convention used by a method described in a METHODDATA structure.

public enum class CALLCONV
[System.Serializable]
public enum CALLCONV
type CALLCONV = 
Public Enum CALLCONV
继承
属性

字段

CC_CDECL CC_CDECL CC_CDECL CC_CDECL 1

指示对方法使用 C 声明 (CDECL) 调用约定。Indicates that the C declaration (CDECL) calling convention is used for a method.

CC_MACPASCAL CC_MACPASCAL CC_MACPASCAL CC_MACPASCAL 3

指示对方法使用 Macintosh Pascal (MACPASCAL) 调用约定。Indicates that the Macintosh Pascal (MACPASCAL) calling convention is used for a method.

CC_MAX CC_MAX CC_MAX CC_MAX 9

指示 CALLCONV 枚举的结尾。Indicates the end of the CALLCONV enumeration.

CC_MPWCDECL CC_MPWCDECL CC_MPWCDECL CC_MPWCDECL 7

指示对方法使用 Macintosh Programmers' Workbench (MPW) CDECL 调用约定。Indicates that the Macintosh Programmers' Workbench (MPW) CDECL calling convention is used for a method.

CC_MPWPASCAL CC_MPWPASCAL CC_MPWPASCAL CC_MPWPASCAL 8

指示对方法使用 Macintosh Programmers' Workbench (MPW) PASCAL 调用约定。Indicates that the Macintosh Programmers' Workbench (MPW) PASCAL calling convention is used for a method.

CC_MSCPASCAL CC_MSCPASCAL CC_MSCPASCAL CC_MSCPASCAL 2

指示对方法使用 MSC Pascal (MSCPASCAL) 调用约定。Indicates that the MSC Pascal (MSCPASCAL) calling convention is used for a method.

CC_PASCAL CC_PASCAL CC_PASCAL CC_PASCAL 2

指示对方法使用 Pascal 调用约定。Indicates that the Pascal calling convention is used for a method.

CC_RESERVED CC_RESERVED CC_RESERVED CC_RESERVED 5

保留此值供将来使用。This value is reserved for future use.

CC_STDCALL CC_STDCALL CC_STDCALL CC_STDCALL 4

指示对方法使用标准调用约定 (STDCALL)。Indicates that the standard calling convention (STDCALL) is used for a method.

CC_SYSCALL CC_SYSCALL CC_SYSCALL CC_SYSCALL 6

指示对方法使用标准 SYSCALL 调用约定。Indicates 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 使用 C 语言的命名和调用约定。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. 此调用约定使你可以调用的函数varargs,使之可用于接受数目可变的参数,例如 C 运行时函数的方法与printf、 _printf_l、 wprintf、 _wprintf_l.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 使用 Pascal 调用约定。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 是 Win32 函数的标准调用约定。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 的类似于 CDECL 在于从右到左推送自变量。CC_SYSCALL is similar to CDECL in that arguments are pushed from right to left. 不保留 EAX、 ECX 和 EDX 寄存器。The EAX, ECX, and EDX registers are not preserved.

使用这些调用约定标识符.NET Framework.NET Framework,则Windows Embedded CEWindows Embedded CE平台,并通过自动化。These calling convention identifiers are used by the .NET Framework.NET Framework, the Windows Embedded CEWindows Embedded CE platform, and by Automation.

有关其他信息CC_CDECL,请参阅 MSDN 库。For additional information about CC_CDECL, see the MSDN Library.

在本机代码中的 COM 方法将返回的 HRESULT 时,公共语言运行时将引发异常。The common language runtime throws an exception when a COM method in native code returns an HRESULT. 有关更多信息,请参见 How to: Map HRESULTs and ExceptionsFor more information, see How to: Map HRESULTs and Exceptions.

适用于

另请参阅