Reputation: 17095
I have a shared dll which is built in 32 bit and 64 bit. Both builds use the same name, foo.dll. How can I install both foo.dlls on the system so that my 32 bit and 64 bit apps find the correct dlls in their path.
Windows itself uses SysWOW64 (for 32-bit dlls) and System32 (for 64-bit dlls). I would like to avoid deploying to these folders. What is the accepted way (if any) to have a dll in both bitnesses coexist on the same box and be found by the appropriate applications that are linked to them?
Upvotes: 1
Views: 1665
Reputation: 104464
You didn't indicate how you were installing your binaries or how they were getting loaded or installed, but I surmise that the solution will involve having separate installation directories for 32-bit vs. 64-bit installs.
Traditionally, 32-bit apps installed on 64-bit machines typically get installed into a subfolder of "c:\program files(x86)" instead of "c:\program files". I'm assuming 32-bit apps and setups (including MSIs) that call GetSpecialFolder, will get redirected to the c:\program files(x86) directory.
You don't have to worry about 64-bit binaries getting installed on 32-bit OS. Just block that from happening in setup, since those binaries won't load anyway.
Upvotes: 0
Reputation: 612794
If you don't deploy to a folder that is subject to file redirection (i.e. system32) then you pretty much need to give the DLLs different names. The reason for this is that the DLL search path is shared between 32 and 64 bit processes and if you are relying on the search path to locate the DLL, that forces you to use different names.
Note that I am ruling out any solutions that rely on SxS versioning. Attempting to go down that route leads to all sorts of complications and headaches for anyone attempting to use your DLL.
Upvotes: 2