Windows – Qt DLL deployment on Windows

dllmanifestwindows

I have a Plug-in for an application from another company. My plug-in uses Qt so it needs the Qt DLLs. My problem is that all versions of 4.x Qt Dlls are called the same, e.g. :QtCore4.dll. It is quite possible that some other plugin, or another application which inserted itself into the PATH environment variable, has put Qt dlls in the applications folder. In that case, the plug-in will not start as it is expecting a different version of the DLL.

  • Q1. What is the suggested common practice for DLL deployment ?
  • Q2. What if the host application uses a different version of Qt. Would windows allow the host application and the plug-in to use different versions () ?

Thanks!

Best Answer

A1: Best practice: put the DLL in the directory of the executable. It will look there first for loading the DLL. This is common practice.

A2: If somehow the application uses a different version of Qt and the module you are describint requires a later or specific version, it might cause a problem (not work, crash, etc).

With static Linking you would also have to consider license restrictions of Qt. LGPL is happy as long as the library is dynamically loaded at runtime and can be separated from the application. This only applies if you do not release your source, etc.

Also, your installer should set up access to those files so that they are protected from being overwritten by some other rogue application.