Static linkage to gtkmm.a difficulties



Hello,

We use the MXE cross compiling environment (http://mxe.cc/) for building the sofware vle (http://www.vle-project.org/wiki/Main_Page) which relies on gtkmm. MXE provides static libraries of gtkmm (actually, all libraries are provided as static libraries). And we have some difficulties using the static version of gtkmm.

I built a litle example which is based on the hello world example of gtkmm and compiled on windows 7 using mingw. Gtkmm so as gtkmm dependencies are
compiled for windows as static libraries using mxe.

That works fine when we link our executable main.exe against gtkmm.a, (the hello world button appears and the signal is taken into account into the function on_clicked_button). The problem arises when an external dll is used (say libhelloworld) in between. We link the libhelloword.dll to gtkmm.a, main.exe to gtkmm.a and libhelloworld.dll.
Execution ends up with error :

(main.exe:2084): GLib-GObject-CRITICAL **: gtype.c:2708: You forgot to call g_type_init()

The two situations are part of the example project which is built with cmake. If you are interested I can send you the project.

My guess is that glib, gtk etc.. require the initialization of static objects. Since main.exe and libhelloworld are statically linked to gtkmm.a then there is duplication of those static objects. And the ones into the dll are not initialized by the gtkmm Main constructor. Am I right ? I tried some initialization functions without success (although error message can be different) e.g :

g_type_init();
Glib::init();
Gtk::Main::init_gtkmm_internals();
gtk_init(NULL,NULL);
gdk_init(NULL,NULL);

Any help/comment is welcome,
Thank you
Ronan

--
Trépos Ronan
INRA unité BIA, équipe MAD, Toulouse
http://carlit.toulouse.inra.fr/wikiz/index.php/Ronan_TREPOS
tel : 05 61 28 51 89



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