ILGenerator.EmitCalli 메서드

정의

MSIL(Microsoft Intermediate Language) 스트림에 Calli 명령을 넣습니다.

오버로드

EmitCalli(OpCode, CallingConvention, Type, Type[])

간접 호출에 대해 관리되지 않는 호출을 지정하여 Calli 명령을 MSIL(Microsoft Intermediate Language) 스트림에 배치합니다.

EmitCalli(OpCode, CallingConventions, Type, Type[], Type[])

간접 호출에 대해 관리되는 호출을 지정하여 Calli 명령을 MSIL(Microsoft Intermediate Language) 스트림에 배치합니다.

EmitCalli(OpCode, CallingConvention, Type, Type[])

Source:
ILGenerator.cs
Source:
ILGenerator.cs
Source:
ILGenerator.cs

간접 호출에 대해 관리되지 않는 호출을 지정하여 Calli 명령을 MSIL(Microsoft Intermediate Language) 스트림에 배치합니다.

public:
 virtual void EmitCalli(System::Reflection::Emit::OpCode opcode, System::Runtime::InteropServices::CallingConvention unmanagedCallConv, Type ^ returnType, cli::array <Type ^> ^ parameterTypes);
public:
 abstract void EmitCalli(System::Reflection::Emit::OpCode opcode, System::Runtime::InteropServices::CallingConvention unmanagedCallConv, Type ^ returnType, cli::array <Type ^> ^ parameterTypes);
public:
 void EmitCalli(System::Reflection::Emit::OpCode opcode, System::Runtime::InteropServices::CallingConvention unmanagedCallConv, Type ^ returnType, cli::array <Type ^> ^ parameterTypes);
public virtual void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Runtime.InteropServices.CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes);
public abstract void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Runtime.InteropServices.CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes);
public virtual void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Runtime.InteropServices.CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes);
public void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Runtime.InteropServices.CallingConvention unmanagedCallConv, Type returnType, Type[] parameterTypes);
abstract member EmitCalli : System.Reflection.Emit.OpCode * System.Runtime.InteropServices.CallingConvention * Type * Type[] -> unit
override this.EmitCalli : System.Reflection.Emit.OpCode * System.Runtime.InteropServices.CallingConvention * Type * Type[] -> unit
abstract member EmitCalli : System.Reflection.Emit.OpCode * System.Runtime.InteropServices.CallingConvention * Type * Type[] -> unit
member this.EmitCalli : System.Reflection.Emit.OpCode * System.Runtime.InteropServices.CallingConvention * Type * Type[] -> unit
Public Overridable Sub EmitCalli (opcode As OpCode, unmanagedCallConv As CallingConvention, returnType As Type, parameterTypes As Type())
Public MustOverride Sub EmitCalli (opcode As OpCode, unmanagedCallConv As CallingConvention, returnType As Type, parameterTypes As Type())
Public Sub EmitCalli (opcode As OpCode, unmanagedCallConv As CallingConvention, returnType As Type, parameterTypes As Type())

매개 변수

opcode
OpCode

스트림에 내보낼 MSIL 명령입니다. Calli이어야 합니다.

unmanagedCallConv
CallingConvention

사용될 관리되지 않는 호출 규칙입니다.

returnType
Type

결과의 Type입니다.

parameterTypes
Type[]

명령에 사용되는 필수 인수의 형식입니다.

예제

다음 코드 샘플에서는 동적 클래스 외부의 관리되지 않는 형식 메서드를 호출하는 메서드의 EmitCalli 컨텍스트 사용법을 보여 줍니다.

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,
               typeof(string),
           new Type[] {});

// More IL code emission here ...
    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 ...

설명

를 사용하여 EmitCalli 스트림에 Calli 명령을 넣습니다. Emit는 사용하지 마세요.

적용 대상

EmitCalli(OpCode, CallingConventions, Type, Type[], Type[])

Source:
ILGenerator.cs
Source:
ILGenerator.cs
Source:
ILGenerator.cs

간접 호출에 대해 관리되는 호출을 지정하여 Calli 명령을 MSIL(Microsoft Intermediate Language) 스트림에 배치합니다.

public:
 virtual void EmitCalli(System::Reflection::Emit::OpCode opcode, System::Reflection::CallingConventions callingConvention, Type ^ returnType, cli::array <Type ^> ^ parameterTypes, cli::array <Type ^> ^ optionalParameterTypes);
public:
 abstract void EmitCalli(System::Reflection::Emit::OpCode opcode, System::Reflection::CallingConventions callingConvention, Type ^ returnType, cli::array <Type ^> ^ parameterTypes, cli::array <Type ^> ^ optionalParameterTypes);
public:
 void EmitCalli(System::Reflection::Emit::OpCode opcode, System::Reflection::CallingConventions callingConvention, Type ^ returnType, cli::array <Type ^> ^ parameterTypes, cli::array <Type ^> ^ optionalParameterTypes);
public virtual void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Reflection.CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes);
public abstract void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Reflection.CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes);
public virtual void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Reflection.CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes);
public void EmitCalli (System.Reflection.Emit.OpCode opcode, System.Reflection.CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes);
abstract member EmitCalli : System.Reflection.Emit.OpCode * System.Reflection.CallingConventions * Type * Type[] * Type[] -> unit
override this.EmitCalli : System.Reflection.Emit.OpCode * System.Reflection.CallingConventions * Type * Type[] * Type[] -> unit
abstract member EmitCalli : System.Reflection.Emit.OpCode * System.Reflection.CallingConventions * Type * Type[] * Type[] -> unit
member this.EmitCalli : System.Reflection.Emit.OpCode * System.Reflection.CallingConventions * Type * Type[] * Type[] -> unit
Public Overridable Sub EmitCalli (opcode As OpCode, callingConvention As CallingConventions, returnType As Type, parameterTypes As Type(), optionalParameterTypes As Type())
Public MustOverride Sub EmitCalli (opcode As OpCode, callingConvention As CallingConventions, returnType As Type, parameterTypes As Type(), optionalParameterTypes As Type())
Public Sub EmitCalli (opcode As OpCode, callingConvention As CallingConventions, returnType As Type, parameterTypes As Type(), optionalParameterTypes As Type())

매개 변수

opcode
OpCode

스트림에 내보낼 MSIL 명령입니다. Calli이어야 합니다.

callingConvention
CallingConventions

사용될 관리되는 호출 규칙입니다.

returnType
Type

결과의 Type입니다.

parameterTypes
Type[]

명령에 사용되는 필수 인수의 형식입니다.

optionalParameterTypes
Type[]

varargs 호출에 사용되는 선택적 인수의 형식입니다.

예외

optionalParameterTypesnull이 아니지만 callingConventionVarArgs 플래그가 포함되어 있지 않은 경우

설명

를 사용하여 EmitCalli 스트림에 Calli 명령을 넣습니다. Emit는 사용하지 마세요.

선택적 인수 callingConvention 를 지정하는 경우 optionalParameterTypes 플래그를 CallingConventions.VarArgs 포함해야 합니다.

적용 대상