I've got a large mature app using Qt 5.6 on Windows 10.

It loads a QPlugin which interfaces to an interpreted language, and that may load many dlls.
At some point, I need to Unload this QPlugin and then load a similar but different plugin that lets me use a different version of the interpreted language.

The problem is that if the first instance of QPlugin loads one version of x.dll, y.dll and z.dll, then the second Plugin tries to use that same dlls, instead of unloading it and using a different version of x.dll, y.dll and z.dll.

If I knew which .dlls were going to be loaded, I could pre-load them with QLibrary, and unload them after I unload the QPlugin.... but that's not always going to be the case.

Is there a way I can unload all of the .dlls loaded by my QPlugin?

(In the visual studio output window, I can see that it usually unloads them, but we're definitely getting errors where it can't find a function that exists in a .dll loaded by the the second QPlugin, and the error tells me it's looking in the loaded-by-first-x.dll)

Thanks!