Hi there! I'm trying to play with plugins for my app...

here is some code:

plugin interface:
Qt Code:
  1. #ifndef PLUGINIF_H
  2. #define PLUGINIF_H
  3.  
  4. class PluginInterface {
  5. public:
  6. virtual ~PluginInterface() {}
  7. virtual QString version();
  8. virtual QString author();
  9. virtual QString description();
  10. virtual QString name();
  11. };
  12.  
  13. Q_DECLARE_INTERFACE(PluginInterface, "Qxygen.PluginInterface")
  14.  
  15. #endif
To copy to clipboard, switch view to plain text mode 

plugin header:
Qt Code:
  1. #ifndef PLUGIN_H
  2. #define PLUGIN_H
  3.  
  4. #include <QObject>
  5. #include <pluginif.h>
  6.  
  7. class plugin: public QObject, public PluginInterface {
  8. Q_OBJECT
  9. Q_INTERFACES(PluginInterface)
  10.  
  11. public:
  12. QString author();
  13. QString version();
  14. QString description();
  15. QString name();
  16. };
  17.  
  18. #endif
To copy to clipboard, switch view to plain text mode 

plugin implementation:
Qt Code:
  1. #include <QtPlugin>
  2.  
  3. #include "plugin.h"
  4.  
  5. QString plugin::author() {
  6. return "Naresh";
  7. }
  8.  
  9. QString plugin::version() {
  10. return "0.0.1";
  11. }
  12.  
  13. QString plugin::description() {
  14. return "plugin descr";
  15. }
  16.  
  17. QString plugin::name() {
  18. return "plugin";
  19. }
  20.  
  21. Q_EXPORT_PLUGIN2(my_plugin, plugin)
To copy to clipboard, switch view to plain text mode 

here is plugin loading loop:

Qt Code:
  1. QDir dir( QCoreApplication::applicationDirPath()+"/plugins/" );
  2. QStringList fileNames=dir.entryList( QStringList("*.so"), QDir::Files, QDir::Name);
  3.  
  4. foreach( QString fileName, fileNames ) {
  5. qDebug()<<dir.absoluteFilePath(fileName); // returns proper path everytime
  6. QPluginLoader loader( dir.absoluteFilePath(fileName) );
  7. QObject *plugin=loader.instance();
  8. if ( plugin ) {
  9. PluginInterface *plif=qobject_cast<PluginInterface*>( plugin );
  10. QStringList values;
  11. values<< plif->name() << plif->version();
  12. new QTreeWidgetItem( ui.pluginList, values );
  13. }
  14. qDebug()<<loader.isLoaded(); // always return false
  15. }
To copy to clipboard, switch view to plain text mode 

project file looks like this:
Qt Code:
  1. TEMPLATE = lib
  2. CONFIG += plugin release
  3. INCLUDEPATH += ../interfaces
  4. TARGET = ../../plugins/plugin
  5. VERSION=0.0.1
  6.  
  7. HEADERS = \
  8. plugin.h
  9.  
  10. SOURCES = \
  11. plugin.cpp
To copy to clipboard, switch view to plain text mode 

As you can see in comments... plugin loading loop always return false for isLoaded and never loads plugin... and path it uses always is proper... any ideas?