2

I have program where I would like to see the benefits of using 64bit however I have a 3rd party dll that is 32 bit.

Can I upgrade my program to 64bit or does it have to be all of nothing?

If it is possible to run with mixed dlls what woudl be the downside?

Xander
  • 9,069
  • 14
  • 70
  • 129
  • 3
    possible duplicate of [Can I load a 32 bit DLL into a 64 bit process on Windows?](http://stackoverflow.com/questions/225151/can-i-load-a-32-bit-dll-into-a-64-bit-process-on-windows) – Kijewski Nov 10 '14 at 22:26
  • Not a duplicate as this is c++ where it should be possible to do this – paulm Nov 10 '14 at 22:31
  • 1
    Cpp or anything else the problem is the same. http://stackoverflow.com/questions/18724384/can-i-link-a-32-bit-native-dll-not-net-assembly-into-my-64-bit-net-applicait/18724699 – ColdCat Nov 10 '14 at 22:43
  • Bah, I basically just posted the manual workaround for the cpp issue, can't really be done easily with .NET though – paulm Nov 10 '14 at 22:44

1 Answers1

1

Lets say your DLL exports an API void foo(); one roundabout way to call this 32-bit function from a 64-bit app is to create a new EXE that wraps this API using IPC.

So you'd have:

  1. A 32-bit EXE that loads the 32-bit DLL with the problematic API.
  2. A 64-bit DLL that replicates the 32-bit DLL API, i.e it has a void foo();
  3. Your client code (probably an EXE or another DLL) links to the 64-bit DLL from step 2, can calls foo() however it likes.

Now for the magic part, the DLL from 2. will launch the EXE from 1, it will then use IPC (probably named pipes) to talk to that EXE and forward the call on to it and return its result.

So you'd have your app -> 64-bit wrapper dll -> named pipe -> 32-bit wrapper app -> 32-bit dll. Abstracted in such a way that calling foo(); API works just as it would if your app 32-bit itself. Obviously this is a pain to implement, so consider rewriting the 32-bit API should you find that this is less effort.

paulm
  • 5,629
  • 7
  • 47
  • 70
  • 1
    On windows wm_copydata could be used for 32/64 communication. As answered it's possible but lot of work. – ColdCat Nov 10 '14 at 23:06
  • Yeah, he didn't specify the platform so couldn't be sure. Also why the downvote? – paulm Nov 10 '14 at 23:13