Using static types from a GTypeModule



Hello everybody,
I have an application using some plugins which define some dynamic types by means of the GTypeModule API. So far, so good. But if one of this plugins is dynamically linked to a library (say, Gtk+) that registers static types, then the plugin cannot be unloaded and loaded again or GType will report the infamous "cannot register existing type [type]" error message. I work around this problem by calling g_type_module_use() to prevent the plugin from being unloaded, but obviously this is not a solution.

How can I allow the plugin to be unloaded and reloaded properly? I'm afraid there is nothing I can do from the application side.

I've looked a bit into the GType source code, and I wonder if it could be possible to have GType forget everything about a type when its reference count gets back to 0, so that it could be registered again from scratch (yes, I can see that this conflicts with the "static" keyword in the name itself, but I believe that static types should'n be used at all, inside a dynamic library).

Comments?

Ciao,
  Alberto

--
http://www.mardy.it <-- Geek in un lingua international!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]