Search code examples
dbus

who will call message_function in dbus.


When we register DBusObjectPathVTable then who will call the message_function? i.e dbus-daemon will call or the dbus main loop ( _dbus_loop_run function) will call?


Solution

  • libdbus will call members of the DBusObjectPathVTable from the libdbus main loop. You could have checked this yourself by grepping for the members in the libdbus source code: cd dbus.git && git grep message_function shows that dbus/dbus-object-tree.c contains all the calls to it. dbus-object-tree.c is part of libdbus.

    It is highly recommended that you use a D-Bus library other than libdbus, however, as libdbus is fiddly to use correctly. If possible, use GDBus or QtDBus instead, as they are much higher-level bindings which are easier to use. If you need a lower-level binding, sd-bus is more modern than libdbus.