ModuleBuilder.DefinePInvokeMethodCore 方法

定義

當在派生類別中覆寫時,定義了一個 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 ^> ^ parameterTypes, System::Runtime::InteropServices::CallingConvention nativeCallConv, System::Runtime::InteropServices::CharSet nativeCharSet);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("P/Invoke marshalling may dynamically access members that could be trimmed.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("P/Invoke marshalling may dynamically access members that could be trimmed.")>]
abstract member DefinePInvokeMethodCore : string * string * string * System.Reflection.MethodAttributes * System.Reflection.CallingConventions * 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, parameterTypes As Type(), nativeCallConv As CallingConvention, nativeCharSet As CharSet) As MethodBuilder

參數

name
String

方法名稱 PInvokename 無法包含嵌入的空。

dllName
String

定義該方法的 DLL PInvoke 名稱。

entryName
String

DLL的入口名稱。

attributes
MethodAttributes

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

callingConvention
CallingConventions

方法是呼叫慣例。

returnType
Type

方法的回傳類型。

parameterTypes
Type[]

方法參數的類型。

nativeCallConv
CallingConvention

原住民呼叫慣例。

nativeCharSet
CharSet

該方法的原生字元集。

傳回

定義 PInvoke 的方法。

屬性

適用於