Re: Problem with Gtk::Window in dynamic library



Try this:
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";
        Gtk::Window* (*func)(void);
        string str("open_dialog");
        if (module.get_symbol( str, (void *&)func))
        {
            cout << "\nfunction found";
            Gtk::Window *wnd;
            wnd = (*func)();            
            cout << "\nafter function";
            cin.get();            
            Gtk::Main::run(*wnd);
        }
    }    
    cin.get();    
    return 0;
}

-------------------------------
library
-------------------------------
#include <iostream>
#include <gtkmm.h>
using namespace std;

extern "C" Gtk::Window *open_dialog()
{
    Gtk::Window *dialog = new Gtk::Window();
    return dialog;
}

-------------------------------

COUT
-------------------------------
(open_dialog.exe:2800): Gtk-WARNING **: Screen for GtkWindow not set; you must a
lways set
a screen for a GtkWindow before using the window

(open_dialog.exe:2800): Gdk-CRITICAL **: gdk_colormap_get_visual: assertion `GDK
_IS_COLORMAP (colormap)' failed

(open_dialog.exe:2800): Gdk-CRITICAL **: gdk_window_new_internal: assertion `GDK
_IS_WINDOW (parent)' failed

(open_dialog.exe:2800): Gdk-CRITICAL **: gdk_window_set_user_data: assertion `wi
ndow != NULL' failed
 and others...
---------------------------------



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