[Mono-list] ldtoken with ByRef, question

Rodrigo Kumpera kumpera at gmail.com
Sat Nov 22 09:47:49 EST 2008


Well, with a methodspec you can encode pointers and custom modifiers, but
not byref.



On Sat, Nov 22, 2008 at 6:52 AM, Jeroen Frijters <jeroen at sumatra.nl> wrote:

> Rodrigo Kumpera wrote:
> > As you have found out ldtoken can only reference types and not type
> > signatures.
>
> Not true. Spec says:
>
> "The token shall be one of:
> A methoddef, methodref or methodspec: pushes a RuntimeMethodHandle
> A typedef, typeref, or typespec : pushes a RuntimeTypeHandle
> A fielddef or fieldref : pushes a RuntimeFieldHandle"
>
> Now, .NET reflection won't allow ILGenerator.Emit(OpCodes.Ldtoken,
> typeof(xxx).MakeByRefType()), but if you create the IL in another way (e.g.
> by using my non-broken IKVM.Reflection.Emit implementation ;-)) you get
> perfectly valid IL.
>
> Regards,
> Jeroen
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20081122/fa1de5fc/attachment.html 


More information about the Mono-list mailing list