9

I have a 32-bit exe that needs to dynamically load a 64-bit dll when it detects that the operating system is 64-bit. Is this possible through LoadLibrary? If not, is there another way to accomplish the same goal?

Mysticial
473k46 gold badges343 silver badges337 bronze badges
asked Mar 17, 2010 at 23:24
1
  • 5
    On a side note, the 32-bit instruction set is called "x86", not "x32". It doesn't really make sense these days, but I guess 8086 deserves to remembered :) Commented Mar 18, 2010 at 9:23

3 Answers 3

12

As previously mentioned, 32-bit code cannot load 64-bit code in the same process. You'll have to load it into a different process (CreateProcess() ?) and use IPC to coordinate.

answered Mar 17, 2010 at 23:36
Sign up to request clarification or add additional context in comments.

1 Comment

Here's a link to a set of ways of doing IPC on windows: msdn.microsoft.com/en-us/library/aa365574(VS.85).aspx. Also check out my answer on another thread for more ways of doing this: stackoverflow.com/questions/446411/remote-procedure-calls/…
2

You can't mix 64-bit and 32-bit code in the same process. You'll need a 32-bit version of the DLL.

answered Mar 17, 2010 at 23:30

Comments

0

WoW64Injection seems what you are looking for.

answered Apr 6, 2024 at 1:18

2 Comments

if the OP can change the code of the 32-bit process to call LoadLibrary then there's no reason to not compile it as 64-bit and load the library directly
That may even be true, but it's still not an answer to the question.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.