I am a newbie in the Qt development environment, I have a deployed a small Qt application (release version) , I have also copied the necessary dlls in the same directory level as the .exe file and a separate folder named platforms for platform specific dll. Now the program runs fine.
But I want to keep the dlls in a separate sub-folder.
Most of the search results I found on this issue provides solution to third-party dlls. And specifically mentions creating a plugins sub-directory but I am trying to move the Qt5core.dll,Qt5Gui.dll,Qt5Widgets.dll and the icu dlls in a separate location (inside the application directory ofcourse).
As far as I have understood, the program searches for the necessary dlls in the same directory level as the .exe file.
So, how is it possible to set a relative path to the dlls ? Where the directory structure looks like:
appDirectory/app.exe
appDirectory/lib/all_necessary_dlls
appDirectory/platforms/platform_specific_dll
I have been searching Qt forums and SO for quite long time but failed to find a satisfying answer.
the Qt dll files are loaded statically at program startup, that means windows will look first in the app directory then in each directory included in the %PATH% environment variable.
So, in order to load them from a sub directory, the only way I can think of is to add your sub directory to the %PATH% environment variable before starting the program (maybe during setup or something), but that is not a clean way to do it at all.
but why would you have to do that anyway?
if you don't like the dll files being distributed with your application, there is always the option of static linking (but make sure you don't break the license when using it).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With