Qt plugin API and kdreports library
-
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).
-
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.