Em qua 18 jun 2014, às 15:20:03, Etienne Sandré-Chardonnal escreveu: > Hi, > > I would like to implement a plugin system in my app and I'm totally > ignorant of dynamic library mechanisms. So I'm trying with a QPlugin. I'm > using Qt 4.8.5, gcc 4.8.0 mingw64. > > The question is : can RTTI work between the plugin and the app?
Yes. But remember the base rule of plugins. A plugin system has: - zero or more applications - zero or more plugins - exactly one library The important part is the library. The base class for RTTI needs to be in the library and properly exported from it (declspec(dllexport) on Windows). > I will define and include these headers in both the app and the plugin: > > - A base class Base which will be pure virtual > - A few DerivedA, DerivedB classes which will be pure virtual, too. > > Then the plugin will derive from one of the DerivedX classes, and provide a > method in the interface which will list its implemented derived class names > as strings, and provide a factory for them returning Base* objects. > > Then, the app will dynamic_cast these pointers to DerivedA, DerivedB, etc... > > Will the dynamic_cast work? Is there a special way to export/declare things > for that? Yes, provided those classes are all in the library. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
