V
VivekR
Hi
I have a class CodeGen in which GenerateILBody is a method that uses
ILGenerator.Emit to create the IL code as method body for a dynamic
method DynMethod. GenerateILBody at runtime must call another method
CallBack of the class CodeGen.
All i have to do is to emit the IL code that loads the object reference
of CodeGen onto the stack, which means I must emit IL in GenerateILBody
to load 'this', which may look like:-
ilgen.Emit(OpCodeToLoad, this);
The this here refers to the CodeGen object reference, and at runtime
will have to use the reference to call the CallBack method.
But there is no overload in ILgenerator.Emit that takes an object
reference.
Please let me know how to load an object reference onto the stack in
IL.
Thanks
Vivek Ragunathan
I have a class CodeGen in which GenerateILBody is a method that uses
ILGenerator.Emit to create the IL code as method body for a dynamic
method DynMethod. GenerateILBody at runtime must call another method
CallBack of the class CodeGen.
All i have to do is to emit the IL code that loads the object reference
of CodeGen onto the stack, which means I must emit IL in GenerateILBody
to load 'this', which may look like:-
ilgen.Emit(OpCodeToLoad, this);
The this here refers to the CodeGen object reference, and at runtime
will have to use the reference to call the CallBack method.
But there is no overload in ILgenerator.Emit that takes an object
reference.
Please let me know how to load an object reference onto the stack in
IL.
Thanks
Vivek Ragunathan