DynamicMethod in Cecil

Is there something similar to Reflection.Emit.DynamicMethod in Cecil? Thank.

  • Dynamicmethod

Edit:

What about the following things?

  1. EmitCall (e.g.
    IL.EmitCall (OpCodes.Callvirt, GetBuildKey, null); IL.Emit (OpCodes.Unbox_Any, dependencyType);)
  2. LocalBuilder (e.g. LocalBuilder resolving = ilContext.IL.DeclareLocal (typeof (bool));)
  3. System.Reflection.Emit.Label (e.g. Label existingObjectNotNull = buildContext.IL.DefineLabel ();) // Should I use TextMap?
  4. ILGenerator.BeginCatchBlock (e.g. ilContext.IL.BeginCatchBlock (typeof (Exception));)
  5. ILGenerator.MarkLabel (e.g. ilContext.IL.MarkLabel (parameter ResolveFailed);)
  6. ILGenerator.EndExceptionBlock () (e.g. ilContext.IL.EndExceptionBlock ();)
+3
source share
1 answer

It is not possible to create DynamicMethod with Cecil and have no equivalent.

The dynamic method is closely related to runtime, and Cecil is completely decoupled. Two of them have a completely separate type system. DynamicMethod should be, well, dynamic, and as such should use the System.Reflection system, like the one available at runtime. Mono.Cecil has a different view of this type system, suitable for static analysis, without actually loading the assembly at run time. Therefore, if you want to use DynamicMethod, you must use it with your environment.

iirc DynamicMethods SRE, Compact Framework, Cecil .

, , , CF-. , - DynamicMethod, Cecil, . (DynamicMethods ), .

Compact Framework, .

+5

Source: https://habr.com/ru/post/1741548/


All Articles