TypeBuilder.DefinePInvokeMethodCore 方法

定义

在派生类中重写时,使用提供的名称、DLL 名称、入口点名称、属性、调用约定、返回类型、参数类型、PInvoke 标志以及参数和返回类型的自定义修饰符定义 PInvoke 方法。

protected:
 abstract System::Reflection::Emit::MethodBuilder ^ DefinePInvokeMethodCore(System::String ^ name, System::String ^ dllName, System::String ^ entryName, System::Reflection::MethodAttributes attributes, System::Reflection::CallingConventions callingConvention, Type ^ returnType, cli::array <Type ^> ^ returnTypeRequiredCustomModifiers, cli::array <Type ^> ^ returnTypeOptionalCustomModifiers, cli::array <Type ^> ^ parameterTypes, cli::array <cli::array <Type ^> ^> ^ parameterTypeRequiredCustomModifiers, cli::array <cli::array <Type ^> ^> ^ parameterTypeOptionalCustomModifiers, System::Runtime::InteropServices::CallingConvention nativeCallConv, System::Runtime::InteropServices::CharSet nativeCharSet);
protected abstract System.Reflection.Emit.MethodBuilder DefinePInvokeMethodCore (string name, string dllName, string entryName, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers, System.Runtime.InteropServices.CallingConvention nativeCallConv, System.Runtime.InteropServices.CharSet nativeCharSet);
abstract member DefinePInvokeMethodCore : string * string * string * System.Reflection.MethodAttributes * System.Reflection.CallingConventions * Type * Type[] * Type[] * Type[] * Type[][] * Type[][] * System.Runtime.InteropServices.CallingConvention * System.Runtime.InteropServices.CharSet -> System.Reflection.Emit.MethodBuilder
Protected MustOverride Function DefinePInvokeMethodCore (name As String, dllName As String, entryName As String, attributes As MethodAttributes, callingConvention As CallingConventions, returnType As Type, returnTypeRequiredCustomModifiers As Type(), returnTypeOptionalCustomModifiers As Type(), parameterTypes As Type(), parameterTypeRequiredCustomModifiers As Type()(), parameterTypeOptionalCustomModifiers As Type()(), nativeCallConv As CallingConvention, nativeCharSet As CharSet) As MethodBuilder

参数

name
String

PInvoke 方法的名称。 name 不能包含嵌入的 null。

dllName
String

定义 PInvoke 方法所使用的 DLL 的名称。

entryName
String

DLL 中入口点的名称。

attributes
MethodAttributes

枚举值的按位组合,指定方法的属性。

callingConvention
CallingConventions

方法的调用约定。

returnType
Type

方法的返回类型。

returnTypeRequiredCustomModifiers
Type[]

表示所需自定义修饰符的类型数组

returnTypeOptionalCustomModifiers
Type[]

表示可选自定义修饰符的类型数组

parameterTypes
Type[]

方法参数的类型。

parameterTypeRequiredCustomModifiers
Type[][]

由类型数组组成的数组。 每个类型的数组都表示相应参数所需的自定义修饰符。

parameterTypeOptionalCustomModifiers
Type[][]

由类型数组组成的数组。 每个类型数组均表示相应参数的可选自定义修饰符。

nativeCallConv
CallingConvention

本地调用约定。

nativeCharSet
CharSet

方法的本地字符集。

返回

一个 MethodBuilder,表示所定义的 PInvoke 方法。

适用于