Results 1 to 8 of 8

Thread: Is it possible to create a plugin interface that uses inheritance?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 127 Times in 121 Posts

    Default Re: Is it possible to create a plugin interface that uses inheritance?

    Plugins can't access members/methods of a class that is defined in the application that load them. If B was a Qt class (and not extended in any way within your app) you could use that inheritance scheme. Otherwise you have two solutions left : drop it and use a new design or put the B class ( and it's dependencies) into a shared library that will be accessible to both the application and the plugins since both could link to it...
    Current Qt projects : QCodeEdit, RotiDeCode

  2. #2
    Join Date
    Jul 2007
    Location
    New York
    Posts
    45
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11
    Thanks
    5

    Default Re: Is it possible to create a plugin interface that uses inheritance?

    If I was to create a shared library, I'm guessing it would make sense for both the application and the plugin to link to the shared dylib instead of the app compiling it in and the plugin linking.

    Would I create a dylib by using the TEMPLATE=lib (with CONFIG=?something?) method or is there another way?

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 127 Times in 121 Posts

    Default Re: Is it possible to create a plugin interface that uses inheritance?

    Quote Originally Posted by themolecule View Post
    Would I create a dylib by using the TEMPLATE=lib (with CONFIG=?something?) method or is there another way?
    That's the way. Add "shared" and/or "dll" to the CONFIG var to make sur you don't get a static build...
    Current Qt projects : QCodeEdit, RotiDeCode

  4. The following user says thank you to fullmetalcoder for this useful post:

    themolecule (22nd August 2007)

  5. #4
    Join Date
    Jul 2007
    Location
    New York
    Posts
    45
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11
    Thanks
    5

    Default Re: Is it possible to create a plugin interface that uses inheritance?

    Thanks!

    And I'm guessing that in the app and the plugin, I include the header for my shared library and include the dylib in the LIBS .pro setting (not include the source cpp in either). This has nothing to do with QPluginLoader and I will have to use otool and install_name_tool to move things for deployment. Is that right?

  6. #5
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 127 Times in 121 Posts

    Default Re: Is it possible to create a plugin interface that uses inheritance?

    Quote Originally Posted by themolecule View Post
    And I'm guessing that in the app and the plugin, I include the header for my shared library and include the dylib in the LIBS .pro setting (not include the source cpp in either). This has nothing to do with QPluginLoader and I will have to use otool and install_name_tool to move things for deployment. Is that right?
    That's right (though I can't help you with Mac deployment issues...). You may also need to change your INCLUDEPATH acordingly.
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.