ILGenerator.EmitCalli メソッド (OpCode, CallingConvention, Type, Type[])
アセンブリ: mscorlib (mscorlib.dll 内)

Public Overridable Sub EmitCalli ( _ opcode As OpCode, _ unmanagedCallConv As CallingConvention, _ returnType As Type, _ parameterTypes As Type() _ )
Dim instance As ILGenerator Dim opcode As OpCode Dim unmanagedCallConv As CallingConvention Dim returnType As Type Dim parameterTypes As Type() instance.EmitCalli(opcode, unmanagedCallConv, returnType, parameterTypes)
public virtual void EmitCalli ( OpCode opcode, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes )
public: virtual void EmitCalli ( OpCode opcode, CallingConvention unmanagedCallConv, Type^ returnType, array<Type^>^ parameterTypes )
public void EmitCalli ( OpCode opcode, CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes )
public function EmitCalli ( opcode : OpCode, unmanagedCallConv : CallingConvention, returnType : Type, parameterTypes : Type[] )


次のコード例は、EmitCalli メソッドを使用して、動的なクラスの外部にあるアンマネージ型のメソッドを呼び出す方法を示しています。
Dim myMthdBuilder As MethodBuilder = myTypeBuilder.DefineMethod("MyMethod", _ MethodAttributes.Public, _ returnType, mthdParamTypes) ' We will assume that an external unmanaged type "LegacyNumber" has been loaded, and ' that it has a method "ToString" which returns a string. Dim unmanagedMthdMI As MethodInfo = Type.GetType("LegacyNumber").GetMethod("ToString") Dim myMthdIL As ILGenerator = myMthdBuilder.GetILGenerator() ' Code to emit various IL opcodes here ... ' Load a reference to the specific object instance onto the stack. myMthdIL.Emit(OpCodes.Ldc_I4, addrOfLegacyNumberObject) myMthdIL.Emit(OpCodes.Ldobj, Type.GetType("LegacyNumber")) ' Make the call to the unmanaged type method, telling it that the method is ' the member of a specific instance, to expect a string ' as a return value, and that there are no explicit parameters. myMthdIL.EmitCalli(OpCodes.Calli, System.Runtime.InteropServices.CallingConvention.ThisCall, _ GetType(String), New Type() {}) ' More IL code emission here ...
MethodBuilder myMthdBuilder = myTypeBuilder.DefineMethod("MyMethod", MethodAttributes.Public, returnType, mthdParamTypes); // We will assume that an external unmanaged type "LegacyNumber" has been loaded, and // that it has a method "ToString" which returns a string. MethodInfo unmanagedMthdMI = Type.GetType("LegacyNumber").GetMethod("ToString"); ILGenerator myMthdIL = myMthdBuilder.GetILGenerator(); // Code to emit various IL opcodes here ... // Load a reference to the specific object instance onto the stack. myMthdIL.Emit(OpCodes.Ldc_I4, addrOfLegacyNumberObject); myMthdIL.Emit(OpCodes.Ldobj, Type.GetType("LegacyNumber")); // Make the call to the unmanaged type method, telling it that the method is // the member of a specific instance, to expect a string // as a return value, and that there are no explicit parameters. myMthdIL.EmitCalli(OpCodes.Calli, System.Runtime.InteropServices.CallingConvention.ThisCall, typeof(string), new Type[] {}); // More IL code emission here ...
MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod" , MethodAttributes::Public, returnType, mthdParamTypes ); // We will assume that an external unmanaged type "LegacyNumber" has been loaded, and // that it has a method "ToString" which returns a String. MethodInfo^ unmanagedMthdMI = Type::GetType( "LegacyNumber" )->GetMethod( "ToString" ); ILGenerator^ myMthdIL = myMthdBuilder->GetILGenerator(); // Code to emit various IL opcodes here ... // Load a reference to the specific Object instance onto the stack. myMthdIL->Emit( OpCodes::Ldc_I4, addrOfLegacyNumberObject ); myMthdIL->Emit( OpCodes::Ldobj, Type::GetType( "LegacyNumber" ) ); // Make the call to the unmanaged type method, telling it that the method is // the member of a specific instance, to expect a String // as a return value, and that there are no explicit parameters. myMthdIL->EmitCalli( OpCodes::Calli, System::Runtime::InteropServices::CallingConvention::ThisCall , String::typeid, gcnew array<Type^>( 0 ) ); // More IL code emission here ...
MethodBuilder myMthdBuilder = myTypeBuilder.DefineMethod("MyMethod", MethodAttributes.Public, returnType, mthdParamTypes); // We will assume that an external unmanaged type "LegacyNumber" // has been loaded, and that it has a method "ToString" which returns // a string. MethodInfo unmanagedMthdMI = Type.GetType( "LegacyNumber").GetMethod("ToString"); ILGenerator myMthdIL = myMthdBuilder.GetILGenerator(); // Code to emit various IL opcodes here ... // Load a reference to the specific object instance onto the stack. myMthdIL.Emit(OpCodes.Ldc_I4, addrOfLegacyNumberObject); myMthdIL.Emit(OpCodes.Ldobj, Type.GetType("LegacyNumber")); // Make the call to the unmanaged type method, telling it that the // method is the member of a specific instance, to expect a string // as a return value, and that there are no explicit parameters. myMthdIL.EmitCalli(OpCodes.Calli, System.Runtime.InteropServices.CallingConvention.ThisCall, String.class.ToType(), new Type[] {}); // More IL code emission here ...

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ILGenerator.EmitCalli メソッド (OpCode, CallingConventions, Type, Type[], Type[])
アセンブリ: mscorlib (mscorlib.dll 内)

Public Overridable Sub EmitCalli ( _ opcode As OpCode, _ callingConvention As CallingConventions, _ returnType As Type, _ parameterTypes As Type(), _ optionalParameterTypes As Type() _ )
Dim instance As ILGenerator Dim opcode As OpCode Dim callingConvention As CallingConventions Dim returnType As Type Dim parameterTypes As Type() Dim optionalParameterTypes As Type() instance.EmitCalli(opcode, callingConvention, returnType, parameterTypes, optionalParameterTypes)
public virtual void EmitCalli ( OpCode opcode, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes )
public: virtual void EmitCalli ( OpCode opcode, CallingConventions callingConvention, Type^ returnType, array<Type^>^ parameterTypes, array<Type^>^ optionalParameterTypes )
public void EmitCalli ( OpCode opcode, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes )
public function EmitCalli ( opcode : OpCode, callingConvention : CallingConventions, returnType : Type, parameterTypes : Type[], optionalParameterTypes : Type[] )

例外の種類 | 条件 |
---|---|
InvalidOperationException | optionalParameterTypes が null 参照 (Visual Basic では Nothing) でないにもかかわらず、callingConvention に CallingConventions.VarArgs フラグが含まれていません。 |

Calli 命令をストリームに書き込むには、EmitCalli を使用します。Emit は使用しないでください。
optionalParameterTypes で省略可能な引数を指定する場合、callingConvention に CallingConventions.VarArgs フラグが含まれている必要があります。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ILGenerator.EmitCalli メソッド

名前 | 説明 |
---|---|
ILGenerator.EmitCalli (OpCode, CallingConvention, Type, Type[]) | 間接的な呼び出しに対してアンマネージ呼び出し規約を指定して、MSIL (Microsoft Intermediate Language) ストリームに Calli 命令を書き込みます。 |
ILGenerator.EmitCalli (OpCode, CallingConventions, Type, Type[], Type[]) | 間接的な呼び出しに対してマネージ呼び出し規約を指定して、MSIL (Microsoft Intermediate Language) ストリームに Calli 命令を書き込みます。 |

Weblioに収録されているすべての辞書からILGenerator.EmitCalliを検索する場合は、下記のリンクをクリックしてください。

- ILGenerator.EmitCalliのページへのリンク