0

There is this guide: http://qt-project.org/doc/qt-4.8/plugins-howto.html

It is totally useless, because it is missing too many crucial information. However after few hours of some research I figured out how to get somewhere:

Source code of interface .h: https://github.com/huggle/huggle3-qt-lx/blob/master/huggle/iextension.h

And .h of plugin: https://github.com/huggle/extensions/blob/master/c%2B%2B/HelloWorld/HelloWorld/helloworld.h

I managed to create an interface for plugin and applied the macro to it, then I created a plugin but as in example the plugin should be inherited from interface, I clearly need to somehow include the .h file from my project. I did that, and then I used QPluginLoader in order to load the .so file.

However I am getting this:

Failed to load (reason: Cannot load library /home/petanb/Documents/huggle3-qt-lx/huggle/extensions/libHelloWorld.so: (/home/petanb/Documents/huggle3-qt-lx/huggle/extensions/libHelloWorld.so: undefined symbol: _ZTIN6Huggle10iExtensionE))

that makes sense, the library (where I #include the .h file of my project) is clearly missing the reference to binary of my application in order to resolve it but how can I give it to that? Should I copy the application's binary, rename it to something.so and put it to /lib or something? Or what should I do?

László Papp
  • 51,870
  • 39
  • 111
  • 135
Petr
  • 13,747
  • 20
  • 89
  • 144
  • You cannot link against an executable, just against a library containing the public interfaces. That shouldn't be necessary for the plugin though. The loader complains that typeinfo for iExtension is missing. Maybe you just forgot to compile a definition of the iExtension destructor into the binary? – Frank Osterfeld Oct 05 '13 at 19:19
  • @FrankOsterfeld what do you mean by "binary" the original application or plugin? – Petr Oct 05 '13 at 19:21
  • Even if I comment out everything from the interface class it still doesn't work... – Petr Oct 05 '13 at 19:27
  • Do you have a definition of the dtor? – Frank Osterfeld Oct 05 '13 at 19:29
  • well, if I added a blank definition it started to work, but how am I supposed to use such a class when I can't predefine any constructor or destructor? I need to load a reference to newly created instance of that class somewhere so that I can access it and call its functions? How can I do that – Petr Oct 05 '13 at 19:37
  • I had a constructor that appended "this" to QList which is static array in somewhere in application so that I can see all loaded extensions and work with them. If I can't create such a constructor, how am I supposed to access the extensions – Petr Oct 05 '13 at 19:38
  • By the way, why don't you inherit a plugin class in your code? Based on the Qt documentation, you should do that. – László Papp Oct 06 '13 at 00:14
  • Why can't you create such a constructor? Just trying to find out if you defined everything necessary (virtual dtor, for example) and compiled it into your application. – Frank Osterfeld Oct 06 '13 at 12:55

0 Answers0