[Mono-devel-list] mono_class_from_mono_type

Joe Ante joe at uti.is
Thu Jun 24 11:53:41 EDT 2004


Hi,

I want to get the type from a c# class, pass it to a c function and extract
the class from the type using eg. This C# code.


    [MethodImplAttribute (MethodImplOptions.InternalCall)]
    public extern static void TestType (Type o);

    static void TestFunc ()
    {
        TestType (typeof (TestClass));
    }


On the c side I want to extract the type and get to the MonoClass:
static void TestType (MonoType* type) {
    MonoClass* klass = mono_class_from_mono_type (type);
    if (klass != NULL)
        printf (mono_class_get_name (type));
}


I get the following assert:

** (process:5834): WARNING **: implement me 0x00

** ERROR **: file class.c: line 2100 (mono_class_from_mono_type): should not
be reached
aborting...


So what is the corresponding struct on the c side for a Type in c#?
Or is there a bug in the runtime?

(In case it is a bug in the runtime, I uploaded a small sample by modifying
teste.c a bit.)

www.otee.dk/Joe/teste.c
www.otee.dk/Joe/test.cs

Joe Ante




More information about the Mono-devel-list mailing list