tags:

views:

1233

answers:

3

I ask because I noticed that many 64 bit EXEs link against what appear to be 32-bit DLLs.

For example, my 64 bit MFC app links against user32.dll, urlmon.dll, wininet.dll - all of which are 32 bit DLLs that reside in windows\system32.

So is this some MS specific wizardry that applies to these DLLs, or is there backward compatability, as it were, for 64 bit EXEs that need to use legacy 32 bit DLLs?

+10  A: 

You cannot link 64-bit EXEs to 32-bit DLLs or vice versa. On a 64-bit Windows OS, the DLLs in Windows\System32 are actually 64-bit DLLs. The 32-bit versions are in Windows\SysWow64.

Curt Hagenlocher
Depends shows those images as 32 bit... how come?
Assaf Lavie
If "depends" is a 32-bit program, then ssg's comment comes into play -- the WOW layer redirects 32-bit applications' view of the file system so that they see what's in SysWow64 as being in System32.
Curt Hagenlocher
+2  A: 

Call 32 from 64, Sure It can. (In windows this is called WOW wich means Windows on Windows). But, viceversa It doesn't work.

Here you have the explanation of how:

http://www.dnjonline.com/article.aspx?ID=jun07_access3264

Hope it serves.

Sheldon
It's a useful technique and it should actually work in both directions, but it's not really "linking against".
Curt Hagenlocher
Oh, OK :D I'll need to learn more about it :D
Sheldon
+1  A: 

The DLLs you mention are included in both 64-bit and 32-bit flavors in a 64-bit Windows installation. 32-bit versions are actually under SysWow64 instead of system32. But WOW-layer shows that folder as "system32" to 32-bit applications so 32-bit/64-bit use happens transparently and smoothly.

Briefly you do not really need to link against 32-bit versions of those DLLs.

ssg