GObject exposure



I have a question related to whether or not I need to go to more deliberate
lengths to hide/shield the gobject's I am producing from the users of my library.

The api's I have implemented deliver (what I wish to be) opaque pointers
to the users of the library.   There are _new, _free and a whole suite of
other functions I have implemented.   The fact that these are gobjects is
not revealed to the user.  The public headers never expose glib-object.h
or any of the standard gobject macros.  Yet, under the covers, they are
gobjects and a savvy user *could* include glib-object.h and manipulate
them as such.

Is it advisable to wrap the gobjects in structures so they cannot be manipulated
using anything other than my api's?

typedef struct _the_object
{
gint cast_guard; /* so you can't cast THE_OBJECTS to the inside gobject */
   GObject   the_object_real;
} THE_OBJECT;

Phil



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