[Qt-interest] [OT] Specify location of DLL dependencies on Windows
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Thu Jan 22 15:27:36 CET 2009
Arve Knudsen wrote on Tuesday, January 20, 2009 7:27 PM:
> I take it noone has a solution for my original problem?
Hello Arve,
sorry, I haven't picked up the "original problem", so sorry if my answer lies far off from what you were asking.
For Unix/Linux you've already read plenty of information (RUNPATH, LD_LIBRARY_PATH, install to "default" locations etc.).
For Windows: "Traditionally" (pre-Manifest file time) DLLs were indeed looked up according to the 'Dynamic-Link Library Search Order', as specified at:
http://msdn.microsoft.com/en-us/library/ms682586.aspx
Now there is a way to specify an "App Path" which is added to PATH at runtime (when you execute the app), see HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths - so for a given executable you can specify the PATH.
I used this feature as to place my DLLs in a 'lib' subfolder, for example
MyApp
+- lib
| +- QtCore4.dll
| +- MyAppLibrary.dll
| +- ...
+- MyApp.exe
And for MyApp.exe specifying e.g. 'c:\Program Files\MyApp\lib' as 'Path' in the registry. I am pretty sure that worked (off course also on "virgin" machines which did not have any development etc. tools installed, and for sure not my application DLLs) - but in fact I don't know WHY, because the above URL will tell you:
"Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path."
Typically you would set this registry key (which is off course dependent on WHERE the users installs the app) with an installer.
Things get even a bit more complicated when you use Manifests: a typical example are the Visual Studio 2005/8 C/C++ runtime DLLs which are specified in the application manifest file: if they are installed under c:\Windows\WinSxS\... and ALSO in the same folder as the *.exe (because you shipped the runtime DLLs with your application in the same folder), the ones from c:\Windows\WinSxS\... are STILL taken! This is on purpose, as to make sure that always the latest (possibly updated) runtime DLLs are taken!
There is a document describing how to hack the manifest file, as to make sure that only the "locally" installed (in your application folder) runtime DLLs are taken:
http://www.codeproject.com/KB/cpp/PrivateAssemblyProjects.aspx
I have never done the above though.
There's also a paging talking about installers and a bit about where to deploy your DLLs:
http://www.codeproject.com/KB/install/Creating_App_Setups.aspx
So this should give you some ideas where to place your DLLs.
Good luck,
Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list