PDA

View Full Version : Reload a Qt Plugin



bunjee
29th December 2009, 20:14
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.

wysota
30th December 2009, 01:17
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.

bunjee
30th December 2009, 15:35
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.

wysota
30th December 2009, 16:36
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.