[Mono-dev] MonoVTable undefined

Thomas Grill gr at grrrr.org
Tue Mar 7 06:51:08 EST 2006

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?

best greetings,

Thomas Grill

More information about the Mono-devel-list mailing list