[SOLVED] Create a shared library without resolving functions or a QPluginLoader interface

  • Hello there

    In the past few days I played with shared and static libraries, QPlugin and QPluginLoader. Now I think it's the time to use these information in a project.

    The plan: I have an application and a backend (shared library). The shared library contains signal and slots and has more than 250 methods. At the moment I link it statically - so exporting is not a problem.

    Now I run into the problem of a shared library:

    So as you can see I need the possibility of the QPluginLoader without the interface (Because the plan is to write a shared library and not an abstract plugin interface). My questions:

    • Is it possible to use a shared library without an interface in combination with QPluginLoader. The solution has to work under windows (Unix-only would be very easy)
    • If not, are there any other solutions ?

    Thank you in advice,

  • Lifetime Qt Champion


    Are you planning to give the means to link to your library along your library ?

  • Hi SGaist

    I have the possibility to link against the (shared) library. I develop both components and deploy both in the same package.

    I use CMake as a build system and under Unix is is possible to create a shared library with add_library(xyz SHARED ...) and put them in the library directory - very nice. But this does not work for windows - so that's my problem

  • Lifetime Qt Champion

    Then you can use the technique described "here":http://qt-project.org/doc/qt-4.8/sharedlibrary.html

  • Ok, thank you, with the Q_DECL_EXPORT/Q_DECL_IMPORT it works like a charm under windows.

Log in to reply

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