Have a static lib, is there a simple way to know it is for 32 bit or 64 bit?

30,514

Solution 1

You can use dumpbin utility with /headers option

It returns whether the library was built for 32 or 64 bit architecture.

Check DUMPBIN Reference for details.

Example usage:

c:\>dumpbin libXYZ.lib /headers

Solution 2

Run a visual studio command prompt to ensure your path can find dumpbin.exe

Pipe to findstr to save on the big spew about each section and optionally you can use a wildcard to analyse a folder of libs.

dumpbin /headers *.lib | findstr machine

Example of what you're looking for;

8664 machine (x64)

Solution 3

I haven't tried this but you can also use file.exe, the unix file equivalent on windows. You can download the binary (and source as well) from here or gnu version here

Share:
30,514
user705414
Author by

user705414

Updated on July 08, 2022

Comments

  • user705414
    user705414 almost 2 years

    Is there any tool that can directly test if a library is made for 32 or 64 bit?

  • stijn
    stijn about 13 years
    this does it, look for the 'FILE HEADERS' section
  • cjs
    cjs about 5 years
    That's just the standard GNU File tool, right? I have tried this with file from a recent version of MinGW from Git for Windows, and it says current ar archive for the x64 python36.lib distributed with Python 3.6 (Windows).