class QApplication;class _interface{public: virtual ~_interface(); virtual void start_plugin( QApplication* );};Q_DECLARE_INTERFACE( _interface, "ru.home.plugin._interface/1.5")
#include <QObject>#include "_interface.h"class QApplication;class main_plugin : public QObject, public _interface { Q_OBJECT Q_INTERFACES( _interface )public: virtual ~main_plugin(){} virtual void start_plugin( QApplication * );};
MainWindow *glpMainWindow;void main_plugin::start_plugin( QApplication* a ){ glpMainWindow = new MainWindow( a ); glpMainWindow->show(); return;}Q_EXPORT_PLUGIN2( _interface, main_plugin )
TARGET = CI_FED15TEMPLATE = libCONFIG += plugin dll
QDir dir( QApplication::applicationDirPath() ); QPluginLoader PluginLoader( dir.absoluteFilePath("pluginapp.dll") ); QObject* pluginapp = qobject_cast<QObject*>( PluginLoader.instance() );
QDir dir( QApplication::applicationDirPath() ); QPluginLoader PluginLoader( dir.absoluteFilePath("CI_FED15.dll") ); QString errstr = PluginLoader.errorString(); QObject* CI_FED = qobject_cast<QObject*>( PluginLoader.instance() );
QDir dir( QApplication::applicationDirPath() ); QPluginLoader PluginLoader( dir.absoluteFilePath("CI_FED15.dll") ); QObject* CI_FED = qobject_cast<QObject*>( PluginLoader.instance() ); QString errstr = PluginLoader.errorString();
a->addLibraryPath( a->applicationDirPath() ); QPluginLoader PluginLoader( "EmptyPlugin.dll" /*abspath*/ ); QObject* CI_FED = qobject_cast<QObject*>( PluginLoader.instance() );
QPluginLoader PluginLoader( "EmptyPlugin.dll" ); // или QPluginLoader PluginLoader(); PluginLoader.setFileName( "EmptyPlugin.dll" ); QString plugname = PluginLoader.fileName();