Expected prototypes into server-side generated glue

Ross Burton ross at burtonini.com
Thu Apr 28 12:06:26 PDT 2005


Hi,

At the moment when dbus-binding-tool generates the server-side glue if
creates an array like this:

static const DBusGMethodInfo dbus_glib_echo_methods[] = {
  { (GCallback) echo_echo, dbus_glib_marshal_BOOLEAN__STRING_POINTER_POINTER, 0 },
};

Where echo_echo is the function I defined in the XML as the C method to
call.  The bindings have strong requirements about the arguments this
function accepts, specifically:

gboolean echo_echo(Echo *echo, const char* string, char **echo_string, GError **error);

Having a implementation of echo_echo which does not match the prototype
expected by DBus (say by changing the C but not the IDL, or vice versa)
would lead to lots of interesting and hard to detect bugs, so why not
put the prototype in the header file?

Attached is a (very rough) patch which does this.  It needs a bit of
tidying up to remove some compile warnings, but it works.

The downside with the current implementation is that the names of the
parameters are in the prototype.  If this idea is accepted I'll change
it so that it only outputs the types:

gboolean echo_echo(Echo*, const char*, char**, GError**);

Comments?

Ross
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-prototypes.diff
Type: text/x-patch
Size: 1527 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050428/7476fbf5/dbus-prototypes.bin


More information about the dbus mailing list