[Mono-list] ldtoken with ByRef, question

Jeroen Frijters jeroen at sumatra.nl
Sat Nov 22 09:51:03 EST 2008


With a typespec you can.

> -----Original Message-----
> From: Rodrigo Kumpera [mailto:kumpera at gmail.com]
> Sent: Saturday, November 22, 2008 15:48
> To: Jeroen Frijters
> Cc: DraconisBG; mono-list at lists.ximian.com
> Subject: Re: [Mono-list] ldtoken with ByRef, question
>
> 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
>
>
>



More information about the Mono-list mailing list