12
votes

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?

3
I think we are all ready for the next version of Dependency Walker. It handles 64 bit executables in a sometimes misleading way, and shows some other annoying warnings. Those are not really bugs, but sure can be better presented. I think these kind of questions are a +1 for a new version. - eran
@Eran, I downloaded the latest depends for 64 bit and it shows the dependent DLLs as 64. - Assaf Lavie
There is actually some wizardry -- on Win64 the 64-bit ntdll.dll gets loaded into ALL processes, both 32-bit and 64-bit. But nothing magic about any of the DLLs you mentioned. - Ben Voigt

3 Answers

24
votes

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.

13
votes

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://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/

Hope it serves.

2
votes

The latest version of Dependency Walker (found here: http://www.dependencywalker.com/) fixes this issue. It finds the correct DLLs, and avoids the inaccurate errors.

(I'm late to the party, but google still found this question when I had a similar problem.)