The only real alternative is the SetDllDirectory() function which was introduced in XP SP1, but this of course requires your application to be running before you load any libraries, and if there is a library in the current directory with the same name as the one you are loading, the directory given to this function is ignored, plus if the library can not be found in the current directory or the directory specified by this function, then it reverts to standard search order.
To confirm the correct set of DLLs are loaded by using a manifest, you would first turn your DLLs in an assembly, by creating a file like so:
<assembly manifestVersion="1.0">
<assemblyIdentity type="Win32" name="mydlls.assembly" version="1.0.0.0" processorArchitecture="x86"/>
<file name="QtCore4.dll" hashalg="SHA1"/>
<file name="QtGUI4.dll" hashalg="SHA1"/>
</assembly>
<assembly manifestVersion="1.0">
<assemblyIdentity type="Win32" name="mydlls.assembly" version="1.0.0.0" processorArchitecture="x86"/>
<file name="QtCore4.dll" hashalg="SHA1"/>
<file name="QtGUI4.dll" hashalg="SHA1"/>
</assembly>
To copy to clipboard, switch view to plain text mode
Your application would then have a manifest embedded within it (or as a seperate .manifest file) which stated that it required "mydlls.assembly" of version "1.0.0.0" and processorArchitecture "x86".
You can then go further if you wished and cryptographically sign the complete assembly package to ensure the correct DLLs are always used with your application (hence the "hashalg" value which may be optional - there is also a publickeytoken value).
For Windows 7, you can also do probing paths, but lets not go there yet, considering how new the OS is.
Bookmarks