I need to access a 32-bit DLL from 64-bit code

I do not have access to the 32 bit dll so I am unable to upgrade it to 64 bits. I also do not want to downgrade the 64 bit code to 32 bits. The only option I'm aware of is using a com wrapper.(https://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/) However, from my knowledge, this will significantly decrease the performance which is unacceptable. Are these my only options?
The only other option is to use a VM library (e.g. https://www.unicorn-engine.org/ ) to run the DLL in a virtualized x86, but I don't know if that will degrade performance even more than IPC.

There's no way to load an x86 DLL in an x64 process, or vice versa, so there's really no other options.
this may be just as bad as the com option, but can you make some sort of high performance 32 bit program that uses the dll and uses shared memory or messaging or something as a go-between to the 64 bit program?

can you tap a 32 bit dll in a 64 bit program directly with assembly?
this will significantly decrease the performance which is unacceptable.

You can't recompile the DLL to be 64-bit, so your options are limited. Performance is less of a concern in this situation.
OP wrote:
I also do not want to downgrade the 64 bit code to 32 bits.


The operative word here is want. Do you have an actual need for the application to be 64-bit? Since the overwhelming majority of applications don't, I'm going to guess no. But with the complete absence of any information about your project we can't know for sure.
Last edited on
Registered users can post here. Sign in or register to post.