Re: g_type_query necessary



On Sat, 16 Sep 2000, Oskar Liljeblad wrote:

> By the way, I am assuming that once you know the class size, you
> can do something like this
> 
>   GObject* obj;
>   GTypeClass* oldclass = obj->g_type_instance->g_class;
>   GTypeClass* newclass = g_malloc(class_size);
> 
>   memcpy(newclass, oldclass, class_size);
>   obj->g_type_instance->g_class = newclass;
> 
> without creating a new type for the class. Is this OK?

as owen already pointed out, you can't. not at all.
since you obviously took the time to lookup the field names
to fiddle with the internals:

struct _GTypeClass
{
  /*< private >*/
  GType g_type;
};
struct _GTypeInstance
{
  /*< private >*/
  GTypeClass *g_class;
};
struct _GTypeInterface
{
  /*< private >*/
  GType g_type;         /* iface type */
  GType g_instance_type;
};

did you not notice any of the "/*< private >*/" markups i put
into gtype.h _intentionally_? ;)

(i say it once more, everything i markup as being "private"
in my APIs, i reserve the right for to rename them randomly from a
cronjob on a monthly basis. i might actually set somthing like
this up if people continue to fiddle with private stuff ;)

> 
> Oskar Liljeblad (osk hem passagen se)
> 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]