Fighting the glib bindings

Rob Taylor robtaylor at floopily.org
Tue Nov 1 02:14:40 PST 2005


The last few days I've been fighting the glib bindings to try and
implement a method of returning arbitary types (i.e. those that are
currently unencodable as a GType of some description).

One example in point is returning an empty a(so). This is encoded as a
GPtrArray+GValueArray, and so if there are no elements, the mashalling
code has no way of determining the subtype of the array, and we error out.

I *think* the correct solution would be to make the marshalling code
aware of what type the user had requested in the typedata blobs, but
this would be quite an invasive change, not only requiring changing the
marshaller, but also dbus-binding-tool (currently the blobs dont store
dbus type information for signals or parameters). A different solution
would be to go the path of Colin Walters' DBUS_TYPE_G_VALUE, but I can't
find any information on what this is...

Hence I have come up with a simple, if brutish, solution for allowing
those that care to exactly specify their return types by building their
own return message using the low-level bindings. This is only usable if
your methods are annotated as org.freedesktop.DBus.GLib.Async, and is
only exposed in <dbus/dbus-glib-lowlevel.h>.

A patch is attached, feedback is appreciated :)

Thanks,

Rob Taylor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-add-sidedoor.patch
Type: text/x-patch
Size: 1530 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20051101/287f34e3/dbus-add-sidedoor-0001.bin


More information about the dbus mailing list