Results 1 to 3 of 3

Thread: Error loading plugin dinamically

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Default Error loading plugin dinamically

    Well, I'm trying to loading the echoplugin, inculded in the Qt's 4.6.0 package from my application but i can't done it. I'm compiling on Windows with Visual Studio and VS Add-in, all projects works fine, and if i compile the Echoplugin example, it loads the plugin fine, but my application can't do it.

    Here is the function:

    Qt Code:
    1. Programa::Programa(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags)
    2. {
    3. ui.setupUi(this);
    4. QDir pluginsDir(qApp->applicationDirPath());
    5. pluginsDir.cd("plugins");
    6. foreach (QString fileName,pluginsDir.entryList(QDir::Files))
    7. {
    8. QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
    9. QObject *plugin = pluginLoader.instance();
    10.  
    11. if (plugin)
    12. {
    13. QMessageBox::information(this,"xD","Plugin cargado!!! :D");
    14. }
    15. else
    16. {
    17. QMessageBox::information(this,"xD",pluginLoader.errorString());
    18. }
    19. }
    20.  
    21. return;
    22. }
    To copy to clipboard, switch view to plain text mode 

    QPluginLoader::instance() returns always null, and the QPluginLoader::errorString() returns "Unknown Error". I think that the code isn't the problem, so i suspect that error could be in the project configuration. ?

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error loading plugin dinamically

    Make sure both your application and the plugin are built in the same mode (either debug or release).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2010
    Posts
    2

    Default Re: Error loading plugin dinamically

    Well, finally i solve it, the error was the compilation mode, i was compiling my application statically, and Qt don't suport making statically linked applications pluggeables.

    Tahnks

Similar Threads

  1. Loading SQLite plugin. Again!
    By miwarre in forum Newbie
    Replies: 5
    Last Post: 12th November 2009, 10:23
  2. ODBC Database plugin is not loading
    By QPlace in forum Qt Programming
    Replies: 11
    Last Post: 4th November 2008, 15:04
  3. Plugin Loading and Signal Handling in Qt4
    By liquid in forum Newbie
    Replies: 4
    Last Post: 25th January 2008, 09:53
  4. How to debug plugin loading?
    By yosefm in forum Qt Tools
    Replies: 1
    Last Post: 1st November 2007, 12:02
  5. plugin loading problem
    By naresh in forum Qt Programming
    Replies: 6
    Last Post: 9th June 2007, 19:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.