32-bit process calls 64-bit dll should also be able to solve this problem, because 64-bit Windows system has installed 32-bit and 64-bit com systems (I have verified) Recently, Windows XP x64 and vs2005 are used as 32-bit Program Compiling a 64-bit program involves some problems that may occur in 64-bit programming, such as inline assembly (solution changed to C/C ++ ). Code ), Long type changes, the most critical problem is that 64-bit processes need to call 32-bit DLL. Because some 32-bit DLL does not Source code And cannot be re-compiled to 64-bit DLL, so I can only find a solution to the problem that 64-bit processes call 32-bit DLL. This problem has caused me to be scratching my head for a few days.
Related information:
The official website of Microsoft is described as follows:
In a 64-bit Windows system, a 64-bit process cannot load a 32-bit DLL. Similarly, a 32-bit process cannot load a 64-bit DLL. However, 64-bit Windows supports RPC between 64-bit and 32-bit processes (including local or cross-host processes ). In 64-bit windows, a 32-bit external process COM server can communicate with a 64-bit client, and a 64-bit external process COM server can also communicate with a 32-bit client. Therefore, if you have a 32-bit com-unrecognized DLL, You can encapsulate it into a non-process COM server and use com configuration to call the DLL in a 64-bit process. (I cannot quite understand the last sentence !! Hahaha)
Verification:
Workflow:
1. Create an external COM server (exe ).
2. encapsulate the 32-bit DLL interface functions as related interfaces of the COM server.
3. register the COM server *. EXE/regserver (cancel *. EXE/unregserver ).
The 32-bit COM server interface is successfully called by the 4.64-bit process. Thus, the curve enables 64-bit processes to call 32-bit DLL.
Procedure:
I first created a simple DLL project and output only one function int c = add (int A, int B); generate lib and DLL
Create an external com (exe type), link the DLL internally, and add method: add (long * C)
{* C = add (1, 2);} compile and generate.
Then register COM, *. EXE/regserver
Create a 64-bit Win32 project to verify that the method call in the 64-bit environment is correct. The verification is correct !!!
Conclusion: The above method can solve the problem of 64-bit process calling 32-bit DLL.