How to release the plugin's dll file when application is running
-
@Christian-Ehrlicher
thans, I tried it but didn't solve the problem. Maybe the usage is incorrect.
such as
loader.setloadhints (0);
loader.unload();@qtyangyong said in How to release the plugin's dll file when application is running:
Maybe the usage is incorrect.
For sure - they're load hints, not unload hints... set it before you load the library.
-
thank you very much, I moved "loader.setLoadHints(0);" before "loader.instance();", the problem was solved. the program such as below:
int main(int argc, char *argv[])
{
......
QPluginLoader loader("ExtraFiltersPlugin.dll");
loader.setLoadHints(0);
QObject *plugin = loader.instance();
if (plugin)
{
FilterInterface *fff = qobject_cast<FilterInterface *>(plugin);
fff->test();
}
MainWindow w;
w.ploader = &loader;
......
}void MainWindow::on_unloadBtn_clicked()
{
ploader->unload();
}