PDA

View Full Version : How to reload widget plugins?



victorng
1st March 2006, 23:35
I've been developing a plugin-based application that has the main executable and several widget plugins (QWidgetPlugin) for additional functionality. Everything works fine. The problem is that during the development of plugins, I would like to simply unload the old version of the widget plugin and reload the new .so (in linux) or .dll (in windows). I do this by making the createWidget call in QWidgetFactory which uses the plugin files to create the widget.

Unfortunately, if I re-compile a new version of a plugin and make a new call to createWidget from QWidgetFactory, I still get a pointer to the older version of the widget and not the new one. Is there anyway to do this in Qt. This would save lots of development time for us because we would not need to constantly restart our main application (which is tedious and time-consuming in our case).

Regards,
Victor

wysota
2nd March 2006, 00:06
You have two choices. One is to make a kind of stub of your application, which will just handle testing plugins. Second is to make sure you unload the plugin before loading it again. I don't know if it works in all environments, but there is a chance that after unloading and loading the plugin again, you'll get the new plugin instead of the old one. Simply reloading the plugin won't do, as it'll see that it's already loaded and will just give you the old pointer.

wysota
2nd March 2006, 00:27
Could you explain the situation a bit more? Are we talking about Designer plugins here or your own (custom ones)? Do you link with them at compilation time?