Thursday, December 6, 2012

How to tell if a DLL is 32-bit (x86) or 64-bit (x64)

On Windows, there are several options for determining whether a given DLL is built for 32-bit or 64-bit CPUs.

You can open in in the wonderful dependency walker tool (kind of like ldd on steroids).

Alternately, Visual Studio (or the Windows SDK, either will do) include a dumpbin program that performs much the same job as objdump. You can use this tool to determine the architecture a DLL was built for.

Start a Windows SDK Command Prompt or Visual Studio command prompt (or run setenv / vcvars) then:

dumpbin /HEADERS thefile.dll | findstr 14C


D:\WinDev>dumpbin /HEADERS zlib1.dll|findstr 14C
             14C machine (x86)

Finally, install GNU File from GnuWin32, then:

D:\WinDev>"%PROGRAMFILES%\GnuWin32\bin\file.exe" zlib1.dll
zlib1.dll; PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit

No comments:

Post a Comment

Captchas suck. Bots suck more. Sorry.