ModuleBuilder.DefinePInvokeMethodCore 方法

定義

在衍生類別中覆寫時,定義 PInvoke 方法。

C#
protected abstract System.Reflection.Emit.MethodBuilder DefinePInvokeMethodCore(string name, string dllName, string entryName, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes, System.Runtime.InteropServices.CallingConvention nativeCallConv, System.Runtime.InteropServices.CharSet nativeCharSet);

參數

name
String

PInvoke 方法的名稱。 name 不能包含內嵌的 null。

dllName
String

PInvoke 方法定義所在的 DLL 名稱。

entryName
String

DLL 中的進入點名稱。

attributes
MethodAttributes

列舉值的位元組合,指定 方法的屬性。

callingConvention
CallingConventions

方法的呼叫慣例。

returnType
Type

方法的傳回類型。

parameterTypes
Type[]

方法參數的類型。

nativeCallConv
CallingConvention

原生呼叫慣例。

nativeCharSet
CharSet

方法的原生字元集。

傳回

已定義的 PInvoke 方法。

適用於

產品 版本
.NET 8, 9, 10