[Mono-list] Internal call structures

Paolo Molaro lupus@ximian.com
Fri, 15 Feb 2002 15:39:11 +0100


On 02/15/02 Dan Lewis wrote:
> Now for MonoReflectionModuleBuilder, there are two levels of
> heirarchy:
> 
> 	typedef struct {
> 		MonoReflectionModule obj;
> 		MonoArray *types;
> 		guint32 table_idx;
> 	} MonoReflectionModuleBuilder;
> 
> So to get at the class for this, you use:
> 
> 	Monoclass *klass = mb.obj.obj.klass;
> 
> This is the way ictool works at the moment, defining a struct as an
> extension of its nearest defined base class. But if you want I could
> change it to always define from MonoObject downwards, or even to just
> define the whole class from nothing. What do you think is best?

You need to always include MonoObject, or it becomes a mess, since the
MonoObject struct can (and will) change without notice (and maybe based
on compilation options, too).

Including all the fields makes for better C code sometimes, but we
loose the info about the hierarchy and passing a common base struct
components will require a cast.
So, I vote for including the base struct type in derived types.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better