Results 1 to 4 of 4

Thread: Reload a Qt Plugin

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Reload a Qt Plugin

    Hi guys,

    Here is a tricky one.

    I'm developing a Qt plugin.
    All it does is creating a widget.

    I'm running my app, loading the plugin, I have my widget shown.

    From that state, is it possible / proper to:

    - Change the widget in the plugin's code.
    - Recompile my plugin.
    - Unload my old plugin while the app is still running.
    - Reload my plugin.
    - Get my new widget shown.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Reload a Qt Plugin

    It should be possible, at least on some of the platforms. See QPluginLoader::unload(). For unload to work you surely have to destroy the plugin instance (and all objects it created) first.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    bunjee (30th December 2009)

  4. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Reload a Qt Plugin

    After further investigation I can already tell that this :

    - Recompile my plugin.
    - Unload my old plugin while the app is still running.

    Is wrong. The dll is locked (at least in win32).

    This is right :

    - Unload my old plugin while the app is still running.
    - Recompile my plugin.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Reload a Qt Plugin

    Yes, you surely have to unload the plugin first. Not only on Windows. On Linux your app would crash if you recompiled the plugin and then something would try to access its code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Extending a plugin in a static library
    By ultim8 in forum Qt Programming
    Replies: 5
    Last Post: 25th March 2010, 16:10
  2. Problem with plugin signals/slots
    By DiamonDogX in forum Qt Programming
    Replies: 8
    Last Post: 5th June 2009, 17:01
  3. Trouble with plugin system's documentation
    By niklas in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2009, 23:07
  4. Plugin implementation question
    By JPNaude in forum Qt Programming
    Replies: 12
    Last Post: 27th August 2008, 21:24
  5. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 15: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.