0

Can we invoke functions of a DLL compiled for 64 bit using an application compiled for 32 bit?

I am using Windows 2008 64 bit system. But, the application is still compiled using 32 bit.

The code involves MFC & Windows SDK functions.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Jay
  • 24,173
  • 25
  • 93
  • 141
  • possible duplicate of [Calling LoadLibrary on a 64-bit dll from a 32-bit process](http://stackoverflow.com/questions/2466637/calling-loadlibrary-on-a-64-bit-dll-from-a-32-bit-process) – Cody Gray - on strike Feb 09 '11 at 05:15

2 Answers2

4

No. A 32-bit application cannot load a 64-bit module into its process space (nor vice versa).

Remember that 32-bit processes are only supported on 64-bit versions of Windows in the dedicated Windows-on-Windows (WOW64) subsystem. That makes interoperability tricky at best. Raymond Chen's blog entry on the subject is quite instructive, if you care about the technical details.

You will either need to recompile one or the other, or load it into a separate process and use interprocess communication to coordinate between the two.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • If it's a COM library you might be able to load it as an out-of-process server, assuming the interface is marshallable... – bdonlan Feb 09 '11 at 07:39
1

That's not possible. Binary code included in the dll is different, and pointers are 64 bits.

Alain Pannetier
  • 9,315
  • 3
  • 41
  • 46