Re: Relationship between Glib and Gobject



On 2/23/06, Ian Turner <ian zmanda com> wrote:
> Hello all,
>
> Yesterday I started reading the GLib documentation in-depth, and I was
> startled to find that the GLib core does not depend on the GObject system. So
> the string library, for example, is not reference-counted.
>
> Furthermore, it appears that while the GLib type system (that is, the gobject
> library) provides an encapsulation method (GBoxed), it does not provide any
> kind of smart-pointer functionality. You can use a GBoxed string, or you can
> put a string in a GValue, but only GObjects have reference counts.
>
> So,
> 1) Please let me know if any of the foregoing is incorrect or misled.
> 2) Is there any (easy) way to fudge a smart-pointer in GLib?
>

Your impressions are largely correct. There is nothing that prevents you
from makeing a refcounted boxed type, though. Just make copy==ref
and destroy=unref. Don't know if thats smart enough...

Matthias



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