[Mono-dev] Re: MonoVTable undefined

Robert Jordan robertj at gmx.net
Tue Mar 7 07:13:28 EST 2006


Thomas Grill wrote:
> Hi all,
> sorry if this is obvious, but it isn't for me....
> The mono/metadata/object.h header file has two convenient macros that 
> i'd like to use
> 
> #define mono_object_class(obj) (((MonoObject*)(obj))->vtable->klass)
> #define mono_object_domain(obj) (((MonoObject*)(obj))->vtable->domain)
> 
> Unfortunately ((MonoObject*)(obj))->vtable points to a MonoVTable 
> structure which is undefined in the public headers.
> It is actually defined in the class-internals.h header, which is 
> obviously internal.
> 
> How would i get the class from an object, other than hackily using the 
> knowledge that klass is the first data member of the undefined vtable?

metadata/object.h:

mono_object_get_class ()
mono_object_get_domain ()

Robert




More information about the Mono-devel-list mailing list