So some time ago I was investigating an issue that I knew would be coming up soon. We have a DLL that links to 32-bit versions of a certain library. There is no x64 version of this library available to us and we have no practical options in regards to replacing it.
When I performed this initial investigation I found an article or two describing a method by which a 64-bit process can utilize a 32-bit DLL (Windows) via a COM "server". Unfortunately I lost the links I had saved and I have now been searching for over an hour with no luck.
Is anyone here familiar with the process I am describing? I can't for the life of me remember which magical incantation I used to pull up the correct result in a search and, of course, it is now implementation time. Thanks in advance for any help you guys can offer, I will continue searching in the meantime.
On 64-bit Windows, a 64-bit process cannot load a 32-bit dynamic-link library (DLL). Additionally, a 32-bit process cannot load a 64-bit DLL. However, 64-bit Windows supports remote procedure calls (RPC) between 64-bit and 32-bit processes (both on the same computer and across computers).
Windows CAN NOT load a 32bit dll into a 64bit process - this is a limitation that you can not circumvent. This means that if your 32bit DLL does any P/Invokes to other 32bit DLLS (or uses any 32bit . Net DLLS) you will be entirely out of luck (you will need to run the entire website in 32bit).
This may not be enough, but it might get you started: Process Interoperability
On 64-bit Windows, an out-of-process 32-bit COM server can communicate with a 64-bit client, and an out-of-process 64-bit COM server can communicate with a 32-bit client. Therefore, if you have a 32-bit DLL that is not COM-aware, you can wrap it in an out-of-process COM server and use COM to marshal calls to and from a 64-bit process.
And Accessing 32-bit DLLs from 64-bit code
Migrating your 32-bit Windows application to a 64-bit machine can be problematic if you have 32-bit DLLs that you cannot re-write. Mike Becker shows you how you can access 32-bit DLLs from 64-bit code using built-in IPC mechanisms...
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