It is possible to load Qt plugin (dll/so, written myself) in a simple C++ program (not Qt)?
It is possible to load Qt plugin (dll/so, written myself) in a simple C++ program (not Qt)?
Hi,
I guess this will be difficult.
For example QObject is inherited by a plugin. Also the interface of the plugin is described in QT types. All the types QObject / the interface types are not known when you are using the plugin without qt. This makes it almost impossible to use the plugin.
I don't think it can easily be achieved, if at all. However, you'd just need to link to QtCore to use Qt's plugin-system.
"If you lie to the compiler, it will get its revenge." - Henry Spencer
The real question is - what for? You can create your own plugin architecture - just make a library of symbols and make sure it exports a function with a known name. Then dlopen and dlsym that function in your application. It should be a factory function for your interface implementation.
2 wysota
"You can create your own plugin architecture"
with Qt, yes?
be please more detailed
2 Methedrine
I didn't think about it, thanks!
"No, with C/C++. Qt doesn't have anything to do with it." ok, I understood, thanks.
One more little question, what soft (under Linux) can show contents of the Static Library (.so) function/classes?
Files with "so" extension are not static libraries, they are shared objects. You can feed such an object to "nm" and it'll return a list of symbols the library contains. Note that the list will contain mangled names!
LMZ (13th June 2007)
Here's a nice plugin system example in plain C++.
I believe it uses windows sdk specific stuff, but I'm sure it could be made cross platform with a few #ifdef's / factories.
http://www.nuclex.org/articles/build...n-architecture
Bookmarks