Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Access Qt plugin classes from other plugins
QtWS25 Last Chance

Access Qt plugin classes from other plugins

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtpluginshared librarysymbol tablesymbol export
4 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joshua195
    wrote on 6 Dec 2015, 21:03 last edited by
    #1

    Hi, I am loading a few shared object plugins using QPluginLoader from some subdirs:

    myInterface.h
    myPluginLoader.h

    -pluginA/interfaceA.h
    -pluginA/implemA.h

    -pluginB/interfaceB.h
    -pluginB/implemB.h

    etc.

    How do I get my pluginB to use classes from pluginA? I have no problem loading the plugins and calling their interface functions from myPluginLoader.h

    In implemB.h, I have included ../pluginA/implemA.h and tried to initialize the implemA class, but I get "symbol lookup error" and "undefined symbol: _ZN6implemAC1ERKd"

    I figure this is probably because I am linking pluginA to the base (myInterface/myPluginLoader etc.) but not linking pluginA to pluginB (and thus getting name mangling). I tried to export implemA using Q_DECL_EXPORT as:

    class Q_DECL_EXPORT implemA
    { ... }
    

    and

    class Q_DECL_IMPORT implemB
    { ... }
    

    as described here: QT Doc Creating Shared Libraries
    but that gave me the same problem. Any idea how to resolve this?

    Thank you!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Dec 2015, 21:47 last edited by
      #2

      Hi and welome to devnet,

      If you have several plugins using shared code then the most simple thing to do is move all the common code in a shared lib that you will link to all the plugins using them.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply 6 Dec 2015, 22:38
      0
      • S SGaist
        6 Dec 2015, 21:47

        Hi and welome to devnet,

        If you have several plugins using shared code then the most simple thing to do is move all the common code in a shared lib that you will link to all the plugins using them.

        J Offline
        J Offline
        Joshua195
        wrote on 6 Dec 2015, 22:38 last edited by
        #3

        @SGaist Thanks for the response!

        I assume the plugins would link to the shared code in the usual way (-Lshared/path -lsharedlib)?

        Is having plugins with dependencies on one another generally considered bad practice?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 6 Dec 2015, 22:45 last edited by
          #4

          That assumption is corrected.

          AFAIK, having linking dependencies between two plugins is not a clean design.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          4/4

          6 Dec 2015, 22:45

          • Login

          • Login or register to search.
          4 out of 4
          • First post
            4/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved