[Qt-interest] Plugin framework
Tim Peeters
thjmpeeters at gmail.com
Tue Nov 24 00:38:49 CET 2009
Thanks Andreas,
I tried your suggestions, but I cannot get it to work yet.
a) Is that really needed? If I look at the simple EchoPlugin example, then
there is no constructor also. I started out with plugins that have a
constructor, but because I could not get it to work I simplified it more and
more until I got to the code I have now.
b) I didn't know that. I was compiling with SHARED flag. Thanks.
However, now with MODULE flag it still gets the lib prefix. I don't know
why. (I'm using CMake 2.6).
c) I tried libbmia_BogusPlugin and bmia_BogusPlugin now but I still get the
same error :(
I don't have the solution yet but I think (hope) that I am slowly getting
closer. My guess was that there was an error with my CMake files, but I
cannot find proper documentation on whether I need to do something special
there to make plugins compile properly.
Should the plugin interfaces really be interfaces? So all functions must be
pure virtual? Or can I implement a couple of functions that I can then use
in all subclasses (i.e., plugins)?
Tim.
On Tue, Nov 24, 2009 at 00:17, Andreas Pakulat <apaku at gmx.de> wrote:
> On 23.11.09 23:52:40, Tim Peeters wrote:
> > My apologies, I only discovered the QPluginLoader::errorString() function
> > now.
> > So if I include this line:
> > if (!loader.load()) cout<<"error:
> > "<<qPrintable(loader.errorString())<<endl;
> > instead of the cout<<"bla" below, it prints the following error message:
> >
> >
> > error: Cannot load library
> > /home/tim/dtibuild/new/bin/libbmia_BogusPlugin.so:
> > (/home/tim/dtibuild/new/bin/libbmia_BogusPlugin.so: undefined symbol:
> > _ZTV11BogusPlugin)
> >
> > Unfortunately I still do not know how to solve this :(
>
> Three things that come to my mind when reading your code:
>
> a) no public constructor for BogusPlugin that takes a QObject parent
>
> b) Plugins are usually built with the MODULE flag for add_library so
> they don't get the lib prefix on linux
>
> c) Q_EXPORT_PLUGIN2 expects a PluginName as first parameter and its said
> this should match the TARGET in the .pro file. So you should probably
> use the libraries basename there (i.e. bmia_BogusPlugin, if you use the
> MODULE mode)
>
> Andreas
>
> --
> Your love life will be... interesting.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091124/5bd4986a/attachment.html
More information about the Qt-interest-old
mailing list