Hello there,
I'm getting an "RTTI symbol not found for class 'QWidget'" (Debug) or a Segmentation fault (direct run) when running an application that makes an dlopen and an dlsym.
In my library I have this:
# define MHD(retType) extern "C" retType __attribute__((visibility("default")))
return new MainWindow(parent); //MainWindow is a QMainWindow subclass
}
# define MHD(retType) extern "C" retType __attribute__((visibility("default")))
MHD(QMainWindow *) newWindow(QWidget * parent){
return new MainWindow(parent); //MainWindow is a QMainWindow subclass
}
To copy to clipboard, switch view to plain text mode
And in my application I have:
void * dso=dlopen("libMHD.so", RTLD_NOW | RTLD_GLOBAL);
nw=(newWindow_t)dlsym(dso, "newWindow");
mw->show();
typedef QMainWindow* (*newWindow_t)(QWidget*);
void * dso=dlopen("libMHD.so", RTLD_NOW | RTLD_GLOBAL);
nw=(newWindow_t)dlsym(dso, "newWindow");
QMainWindow* mw=nw(this);
mw->show();
To copy to clipboard, switch view to plain text mode
With both projects open in QtCreator I am able to debug, and reach the constructor of MainWindow, then stepping into, I fall in a QFlag definition, then SIGSEGV... 
I need this to make an application open plugins... The idea is to have a function in each library that returns an std::vector containing all wrappers (I have a base class, and this one have a method const char* getKey(), so I can call a Factory to create new instances of each class using a string.).
This is my first step, and I can't proceed...
So, why, even with QT+= core gui, I'm getting such error?
(Sorry English mistakes...)
Thanks in advance.
Bookmarks