Qt plugin API and kdreports library



  • Hello,
    I plan to use the GPL version of "KDReports":http://kdab.com/kd-reports library to generate reports in my application. All the functionnalities of my application are provided by plugins. After compiling the KDReports library, when I link one of my plugins with the KDReports library, this plugin is not recognized as a plugin.
    If someone had a similar problem or know something about it, please explain to me.
    Thanks



  • Nobody can help me ?


  • Moderators

    Please be patient. All responses here are from volunteers who are working on their own time. If someone has knowledge in the area you need help with, I'm sure they will respond as soon as they can.

    In the mean time, can you provide more information, such as any error messages, platform type, versions of software, or any other data that might help someone understand the specifics of your problem more clearly, please?

    Thanks!


  • Moderators

    Did you follow the tutorials provided?

    bq. KD Reports comes with a manual that provides tutorials and references.  Also, examples are part of the source code that can be customized and used.

    bq. Everything Included
    KD Reports licenses include:
    The full source code.
    A Reference Manual.
    A Programmer’s Manual with step-by-step tutorials.



  • I followed the tutorials. My problem is that when I link my plugin with kdreports library, my plugin is not recognized as a plugin by the core application. Below is the function which load the plugins
    @
    ...
    foreach(QString fileName, pluginsDir.entryList(QDir::Files))
    {
    QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
    QObject *plugin = loader.instance();

        if(!plugin)
              qDebug() << "Not a plugin";
        else
        {
            PxPluginInterface *pxPlugin = qobject_cast<PxPluginInterface*>(plugin);
    
            if(pxPlugin)
                m_pluginsList << pxPlugin;
        }
    

    }
    @

    After linking with kdreports library, I always have the message "Not a plugin" and I don't have access to the plugin functionnality, but if I unlink with kdreports, the application works well.

    I'm using the latest QtSDK on Mac OS X Snow Leopard. I had the same problem on GNU/Linux(Fedora).


  • Moderators

    You could use
    @QString QPluginLoader::errorString () const@
    To get more info about what's wrong.



  • I have only the message
    @"Cannot load library ..."@



  • Have you tried stepping into the QPluginLoader constructor and the instance method?
    (Don't forget to setup the correct Qt source pathes in Qt Creator).



  • Sorry, I don't understand what you mean. Stepping into with the debugger ?
    And to setup the correct Qt source paths in Qt Creator



  • Just place a breakpoint at line #4 and then step through to find out what's going wrong.

    For having the Qt sources displayed correctly during debug you might have to install (SDK Maintainance Tool) and setup the Qt sources within Qt Creator (somewhere Options -> Debugger -> Source Pathes).



  • Can the system dynamic linker resolve the kdreports library location when trying to load your plugin?



  • Thanks, the system effectively didn't resolve the kdreports library. But I added the path to kdreports to DYLD_LIBRARY_PATH
    @export DYLD_LIBRARY_PATH = ...@
    I have to copy the library in /usr/lib before the application works.



  • Glad to hear it is resolved.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.