#include <QObject>#include <QtCore>#include <QString>class pluginInterface : public QObject{public: virtual ~pluginInterface() {} virtual QString getAuthor() = 0;};Q_DECLARE_INTERFACE (pluginInterface, "zodiac.pluginInterface/1.0")
#include <QtCore>#include "../pluginInterface.h"class testPlugin : public pluginInterface{ Q_OBJECT Q_INTERFACES(pluginInterface)public: QString getAuthor() { return "zodiac"; }};Q_EXPORT_PLUGIN(testPlugin);
pluginsDir = QDir(qApp->applicationDirPath()); pluginsDir.cd("plugins"); foreach (pluginFileName, pluginsDir.entryList(QDir::Files)) { QPluginLoader loader(pluginsDir.absoluteFilePath(pluginFileName)); plugin = loader.instance(); QMessageBox::information(0, "!!!", loader.errorString()); }
#include <QtCore>#include "../pluginInterface.h"class testPlugin : public QObject, public pluginInterface{ Q_OBJECT Q_INTERFACES(pluginInterface)public: QString getAuthor() { return "zodiac"; }};Q_EXPORT_PLUGIN2(testPlugin, testPlugin);
#include <QObject>#include <QtCore>#include <QString>class pluginInterface{public: virtual ~pluginInterface() {} virtual QString getAuthor() = 0;};Q_DECLARE_INTERFACE (pluginInterface, "zodiac.pluginInterface/1.0")
zodiac@zodiac ~/Desktop/crypt/main/plugins $ nm libtest_plugin.so00002034 d DW.ref.__gxx_personality_v000001e6c a _DYNAMIC00001ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses U _Unwind_Resume@@GCC_3.000002040 b _ZGVZ18qt_plugin_instanceE9_instance U _ZN11QMetaObject11changeGuardEPP7QObjectS1_ U _ZN11QMetaObject11removeGuardEPP7QObject00000be0 W _ZN15pluginInterfaceD0Ev00000c10 W _ZN15pluginInterfaceD1Ev U _ZN7QObjectC2EPS_00001e64 V _ZTI15pluginInterface00000ca0 V _ZTS15pluginInterface U _ZTV10testPlugin00001e50 V _ZTV15pluginInterface U _ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.300002048 b _ZZ18qt_plugin_instanceE9_instance U _ZdlPv@@GLIBCXX_3.4 U _Znwj@@GLIBCXX_3.4....
zodiac@zodiac ~/Desktop/crypt/main/plugins $ nm libtest_plugin.so00002034 d DW.ref.__gxx_personality_v000001e6c a _DYNAMIC00001ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses U _Unwind_Resume@@GCC_3.000002040 b _ZGVZ18qt_plugin_instanceE9_instance U _ZN11QMetaObject11changeGuardEPP7QObjectS1_ U _ZN11QMetaObject11removeGuardEPP7QObject00000be0 W _ZN15pluginInterfaceD0Ev00000c10 W _ZN15pluginInterfaceD1Ev U _ZN7QObjectC2EPS_00001e64 V _ZTI15pluginInterface00000ca0 V _ZTS15pluginInterface U _ZTV10testPlugin <<<<<<<<<<<<<<<<<<<<<<<<00001e50 V _ZTV15pluginInterface U _ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.300002048 b _ZZ18qt_plugin_instanceE9_instance U _ZdlPv@@GLIBCXX_3.4 U _Znwj@@GLIBCXX_3.4....
class testPlugin : public QObject, public pluginInterface
class testPlugin : public pluginInterface, public QObject