Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Plugin can load or not depending on whether my app is launched from Qt Creator or not
QtWS25 Last Chance

[SOLVED] Plugin can load or not depending on whether my app is launched from Qt Creator or not

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    agarny
    wrote on last edited by
    #1

    Hi, I am having an unexplained behaviour using Qt 4.7.3 and Qt Creator 2.2.1 on Windows 7 (everything works fine on Ubuntu 10.10 and Mac OS X 10.6 using the same versions of Qt and Qt Creator).

    Basically, my application relies on various plugins being loaded upon starting my application. Now, for some weird reason, there is one out of 10 plugins that doesn't load when running my application from outside Qt Creator while if I start my application from within Qt Creator, then the plugin loads fine! This is the case whether I build a debug or release version of my application.

    As I said, everything works fine on Linux and Mac OS X, so I am really puzzled as why that particular plugin doesn't load. Why that plugin?!

    I know it might be a very long shot, but is there something trivial that I might have overlooked?

    Here is some code that I use (before actually loading the plugin) to retrieve some information about the plugin itself:

    @PluginInfo Plugin::info(const QString &pPluginFileName)
    {
    // Return the information associated to the plugin

    PluginInfo pluginInfo;
    
    typedef PluginInfo (*PluginInfoFunc)();
    
    PluginInfoFunc pluginInfoFunc = (PluginInfoFunc) QLibrary::resolve(pPluginFileName,
                                                                       QString(name(pPluginFileName)+"PluginInfo").toLatin1().constData());
    
    if (pluginInfoFunc)
        // The plugin information function was found, so we can extract the
        // information we are after
    
        pluginInfo = pluginInfoFunc();
    else
    

    {
    // The plugin information funciton couldn't be found which means that
    // we are not dealing with an OpenCOR plugin

        pluginInfo.type = PluginInfo::Undefined;
    

    if (!name(pPluginFileName).compare("CellMLModelRepository")) {
    QLibrary lib(pPluginFileName);

    if (lib.load())
        QMessageBox::information(0, QString("Info"), "Can load...");
    else
        QMessageBox::information(0, QString("Info"), QString("Can NOT load... [%1 | %2]").arg(pPluginFileName,
                                                                                              QFileInfo(pPluginFileName).exists()?"YES":"NO"));
    

    }
    }@

    So, what happens is that I am trying to resolve a function which should be in my plugin. In all cases, it works but for that CellMLModelRepository plugin of mine. Having added some debug code, if the function cannot be found, I try to load the plugin using QLibrary which here fails for my CellMLModelRepository plugin even though QFile::exists() does report that the file exists...

    1 Reply Last reply
    0
    • A Offline
      A Offline
      agarny
      wrote on last edited by
      #2

      For those curious about the above 'problem' that I reported, you can find some interesting information at Qt Centre where I also asked for some help: http://www.qtcentre.org/threads/42849-Plugin-can-load-or-not-depending-on-whether-my-app-is-launched-from-Qt-Creator-or-not.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved