[Mono-dev] Embedding Scenario with MonoReflectionType

Robert Jordan robertj at gmx.net
Mon Mar 22 05:56:58 EDT 2010


On 22.03.2010 09:38, Laurent Etiemble wrote:
> Hello,
>
> I am working on embedding Mono and I am stuck with the following issue: I
> would like to get a MonoClass or a MonoType instance from
> a MonoReflectionType instance.
>
> So, imagine I have an internal call with the following signature:
>

There is no way to the a MonoType* from a MonoReflectionType*
than getting it from Type.TypeHandle.Value.

Here is a solution for your problem:


[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern String GetName(IntPtr typeHandle);

public static String GetName(Type type)
{
     return GetName (type.TypeHandle.Value);
}

>
> Then, the implementation should look like:
>
> MonoString *ves_icall_XXX_ GetName(MonoReflectionType *type) {


MonoString *ves_icall_XXX_ GetName(MonoType *type)
{
...
}


Robert



More information about the Mono-devel-list mailing list