Re: [Gnome-bindings] Ok, here we go...



briot gnat com writes:

> One thing you did not put on your list, and that is used heavily at least in
> the GtkAda binding is that each time a function takes a "user_data" (this is
> true for callbacks and a few other functions like idle and timeouts), it
> should provide two versions:
> 
>     gtk_connect (foo, gpointer user_data);
>        /* for C users' convenience */
> 
>     gtk_connect_full (foo, gpointer user_data, DestroyFunc);
>        /* for bindings convenience */

*** Fortunately, closures are coming in GTK+ 1.4, which should solve
    the issue altogether, but before that, this one, directly from
    gnome-language-bindings.tex, is still valid :

- callbacks must always carry one freely setable pointer
  argument. Callbacks should also have a DestroyNotify.


> 
> It allows the bindings to copy an internal structure compatible with a
> gpointer, even if the real type in the binding is not, and still get the
> memory management done by gtk+.
> 
> For instance, Strings in Ada are not fully compatible with gchar*, since they
> also include bounds information. Thus, we do a copy internally that is
> compatible with a gchar*/gpointer, and free the allocated memory whenever gtk+
> calls DestroyFunc above.
> 
> I believe that gtk+ is mostly clean in that regard, I haven't looked carefully
> at Gnome yet, and I know that gtk+extra is not compatible.
> 
> Emmanuel
> 

-- 
					Guillaume.
					http://www.telegraph-road.org




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