GDBus proxy connection failure: using g_initable_new()

I have written a minimalistic client-server application based on the GDBus library to get DBUS communication up and running.

  1. server.c -provides “gdbus-server” executable
  2. client.c: -containing only two api’s ie. connect_dbus() and disconnect_dbus(), which as the name suggests simply creates and unref the proxy connection respectively.
    -provides “libdbus-client.so”

In another test application, I tried dynamically loading “libdbus-client.so” using dlopen(), called “connect_dbus()” and “disconnect_dbus()” in client side, and finally used dlclose() to decrement the reference count of the handle loaded in dlopen, all of these operation were written inside a for loop.

Issue: After the 1st iteration, proxy connection is not being established in the 2nd iteration. However, I am not getting this error when removing dlclose() from the for loop.

Error logs: (process:48552): GLib-GObject-WARNING **: 11:17:37.520: cannot register existing type 'XYZManagerCoreProxy'

(process:48552): GLib-GObject-WARNING **: 11:17:37.520: cannot add private field to invalid (non-instantiatable) type ''

(process:48552): GLib-GObject-WARNING **: 11:17:37.520: cannot register existing type 'XYZManagerCore'

(process:48552): GLib-GObject-CRITICAL **: 11:17:37.520: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(process:48552): GLib-CRITICAL **: 11:17:37.520: g_once_init_leave: assertion 'result != 0' failed

(process:48552): GLib-GObject-CRITICAL **: 11:17:37.520: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:48552): GLib-CRITICAL **: 11:17:37.520: g_once_init_leave: assertion 'result != 0' failed

(process:48552): GLib-GIO-CRITICAL **: 11:17:37.520: g_initable_new_valist: assertion 'G_TYPE_IS_INITABLE (object_type)' failed

Any help would be highly appreciated. Thanks!

You cannot dlopen/dlclose GObject-based libraries if they register a static type; and, in general, you cannot unload libgobject/libgio.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.