gobject, loadable modules




Hello,

I'm trying to build a small program using loadable modules, so I have
this setup:

A class called Plugin (inherits from GTypeModule) which is responsible
for loading/unloading.

A class called TestPlugin (inherits from GObject)

A function in the so-file called plugin_init, which registers the type
with g_type_module_register_type.

in the main program I load the plugin, and runs plugin_init (from the
testplugin.so), and everything seems fine.

After this, GType g_type_from_name("TestPlugin") works fine, but
g_object_new(g_type_from_name("TestPlugin", NULL) causes a segfault (i
have traced it with gdb and it segfaults at the g_object_new function).

I compile the so-file with -shared, and everything i expose is
non-static and has G_MODULE_EXPORT.

Any obvious fault here? I can attach the code (very little code) if that
helps.

Any help would be appreciated!

-- 
Morten O. Hansen <morteoh chello no>




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