在Windows上确定静态库(LIB)的CPU架构

47

我刚在一台64位Windows机器上使用VS2008构建了libpng。它生成一个libpng.lib文件,位于\projects\visualc71\Win32_Lib_Release目录下(使用的配置为"LIB Release")。

我使用dumpbin来检查这个LIB文件:

C:\Temp\libpng-1.4.3>dumpbin projects\visualc71\Win32_LIB_Release\libpng.lib
Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file projects\visualc71\Win32_LIB_Release\libpng.lib

File Type: LIBRARY

  Summary

         8E4 .debug$S
         DF2 .drectve
        2BCD .rdata
       21165 .text

C:\Temp\libpng-1.4.3>

但是,它并没有显示LIB文件的架构。我该如何查找给定的LIB文件是为32位还是64位架构构建的?

1个回答

68

使用dumpbin /headers命令。

机器类型是您将获得的几乎第一行内容。

x86的机器类型为14c,x64的机器类型为8664。

n:> dumpbin lib642.lib /headers

Microsoft(R)COFF/PE转储程序版本
10.00.30319.01 版权所有(C) Microsoft Corporation。保留所有权利。

正在转储文件lib642.lib

文件类型:库

文件头值 8664 machine (x64)

或者

n:>dumpbin Lib32.lib /headers

Microsoft (R) COFF/PE Dumper Version
10.00.30319.01 版权所有(C) Microsoft Corporation。保留所有权利。

正在转储文件Lib32.lib

文件类型:库

文件头值 14C machine (x86)


2
这个Windows资源管理器的属性扩展可以显示架构信息,而无需使用工具:http://sanje2v.wordpress.com/2013/12/10/writing-property-handler-for-windows-explorermanta-property-extension/ - Sanjeev
7
dumpbin 命令可在 Visual Studio 命令提示符 中使用。 - Calin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接