Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using x64 dll in x86 application

Tags:

c++

com

I have a DLL that needs to operate large ammounts of memory and must be x64 to do that, but the application, which calls it is x86 and can not be converted to x64. COM is already used for interaction between application and the dll.

Is it possible to use surrogate process for that purpose?

I know that it is possible to do such a thing in the opposite case (run x86 COM library in x64 application), will there be any difference?

like image 446
nexx Avatar asked Sep 02 '10 04:09

nexx


People also ask

Can x64 programs run on x86?

Yes it is possible & it will run properly. Instruction Set Architecture is always backwards compatible.

How do you call a 64-bit DLL from a 32-bit application?

Solution. You cannot call a 64-bit DLL from 32-bit LabVIEW. This is a limitation of 64-bit Windows, which does not support mixed 64-bit/32-bit processes. The recommended solution is to recompile the DLL from the source code for a 32-bit target architecture.

Can a 64-bit application run on a 32-bit DLL?

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).

Where do I put a 64-bit DLL?

Under 32bit windows, this location is (typically) C:\WINDOWS\SYSTEM32. Under 64bit windows, it is C:\WINDOWS\SYSWOW64. Also under 64bit windows, the 64bit DLL shared location is C:\WINDOWS\SYSTEM32.


1 Answers

Yea, you can, and there should be no differences as COM handles everything for you.

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.

http://msdn.microsoft.com/en-us/library/aa384231(VS.85).aspx

like image 80
Baiyan Huang Avatar answered Sep 21 '22 04:09

Baiyan Huang