Return an object from a method

Robert McQueen robert.mcqueen at
Thu May 11 06:01:06 PDT 2006

Luigi Paioro wrote:
> Hi,
>   I'm new to DBUS, and I would like to have an information about what
> kind of data types a DBUS object method cans return. In particular, is
> it possible to get an object instance as returned value from a DBUS
> object method call?

No, you cannot send an object over the bus in this way. You have two
options, one of which is like sending a reference, and one is like
sending a copy.

To send a reference, you export the object inside your sending process
on the bus, and send its object path to the other end, so that they can
make a proxy on their end and use it to make D-Bus method calls to your

To send a copy, simply make a tuple that contains all of the object's
data members, which D-Bus will send as a struct, and use that tuple at
the other end to construct a copy of the object.

It depends whether you would like a copy of the object when you "send it
over the bus", or a reference to the original object in the sending process.

> Luigi


More information about the dbus mailing list