Problem with Gtk::Window in dynamic library



main.cpp:
--------------------------------------------------------
#include <locale.h>
#include <libintl.h>
#include <gtkmm.h>
#include <glibmm.h>
#include <iostream>
using namespace std;

int main(int argc, char ** argv)
{
    Glib::Module module("./open_dialog.dll");
    if (module)
    {
        cout << "\nmodule loaded ok";
        void (*func)(unsigned long *);
        string str("open_dialog");
        if (module.get_symbol( str, (void *&)func))
        {
            cout << "\nfunction found";
            unsigned long id = 0;
            (*func)(&id);
        }
    }
    cin.get();
    return 0;
}
------------------------------------------------------------

open_dialog.cpp: (dynamic library)
-------------------------------------------------------------
#include <locale.h>
#include <libintl.h>
#include <iostream>
#include <gtkmm.h>
using namespace std;

void _init()
{	
    cout << "\n_init()";
}

void _finit()
{
    cout << "\n_finit()";
}

extern "C" void open_dialog(unsigned long *id)
{
    cout << "\nopen_dialog\nid = " << *id;
    Gtk::Window *dialog = new Gtk::Window();
    Gtk::Main::run(*dialog);
    cin.get();
    delete dialog;
}
-------------------------------------------------------------

cout:
-----------------------------------------------
module loaded ok
function found
open_dialog
id = 0
(open_dialog.exe:2172): GLib-GObject-CRITICAL **: gtype.c:2254: initialization a
ssertion failed, use g_type_init() prior to this function

(open_dialog.exe:2172): GLib-GObject-CRITICAL **: gtype.c:2254: initialization a
ssertion failed, use g_type_init() prior to this function

(open_dialog.exe:2172): GLib-GObject-CRITICAL **: gtype.c:2254: initialization a
ssertion failed, use g_type_init() prior to this function

(open_dialog.exe:2172): GLib-GObject-CRITICAL **: g_type_add_interface_static: a
ssertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(open_dialog.exe:2172): GLib-GObject-CRITICAL **: gtype.c:2254: initialization a
ssertion failed, use g_type_init() prior to this function

(open_dialog.exe:2172): GLib-GObject-CRITICAL **: gtype.c:2254: initialization a
ssertion failed, use g_type_init() prior to this function

(open_dialog.exe:2172): GLib-GObject-CRITICAL **: gtype.c:2254: initialization a
ssertion failed, use g_type_init() prior to this function
------------------------------------------------

Where is a problem and why?



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