[patch] generate marshallers and metadata from dbus-glib-tool
kuliniew at purdue.edu
Tue Nov 9 19:23:34 PST 2004
On Tue, Nov 09, 2004 at 08:59:22PM -0500, Colin Walters wrote:
> On Tue, 2004-11-09 at 17:37 -0500, Paul Kuliniewicz wrote:
> > I've made some relatively minor changes to my patch for generating
> > marshallers for the GLib bindings. The updated patch and a
> > demonstration of its usage are attached.
> Cool, works for me. We need to get Oliver's signal work added; after
> that it looks like we're mostly blocked on GObject introspection, right?
Signals and supporting multiple OUT parameters are the only things I can
> > [How do we know whether to free a returned string or not?]
> To be a bit more precise, the distinction is ownership of the memory,
> not dynamic/static allocation. One approach would be to just always
> assume the marshallers own the string, but that would kind of suck if
> you were were exporting say a text widget with a GetBuffer method, that
> would normally return a const pointer to a potentially very large
> buffer. On the other hand - DBusMessage already copies everything you
> stick in to it (something I think we should not do as an option for byte
>  at least, but that's another issue).
Right, the question is really one of ownership instead of static v.
I remember it being mentioned that the idea is that you create an object
specifically to be exported, rather than exporting an object you
otherwise happen to have lying around. This means that we can make some
reasonable demands on the sort of interface the object provides. One of
those can be that any strings returned by a method are owned by the
caller. This lets the marshallers g_free any strings without a problem,
and it's trivial for the methods themselves to make a copy of the string
they own, if need be.
So, long story short, it sounds like I agree with you -- g_free all
strings returned by the method. That certainly simplfies things quite a
> Nice work! I'm really inteterested in getting the glib bindings going
> well; a lot of work blocks on that.
I should be able to get a new version of the patch out in a couple of
days. And once Oliver's signal work is added, the service-side GLib
bindings should be complete enough to use in an application.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://freedesktop.org/pipermail/dbus/attachments/20041109/83982fcc/attachment.pgp
More information about the dbus