确定 Windows 上静态库 (LIB) 的 CPU 体系结构
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3322630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Determining the CPU architecture of a static library (LIB) on Windows
提问by Sridhar Ratnakumar
I just built libpng on a 64-bit Windows machine using VS2008. It produces a libpng.lib
file inside the \projects\visualc71\Win32_Lib_Release directory (Configuration used being "LIB Release").
我刚刚使用 VS2008 在 64 位 Windows 机器上构建了 libpng。它libpng.lib
在 \projects\visualc71\Win32_Lib_Release 目录中生成一个文件(使用的配置为“LIB Release”)。
I used dumpbin
to inspect this LIB file:
我曾经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>
It does not however show the architecture of the LIB file. How do I find if a given LIB file is built for 32-bit or 64-bit architecture?
然而,它没有显示 LIB 文件的架构。如何确定给定的 LIB 文件是为 32 位还是 64 位架构构建的?
回答by Will Dean
Use dumpbin /headers
使用 dumpbin /headers
The machine type is almost the first line you'll get.
机器类型几乎是您将获得的第一行。
It will be 14c for x86 and 8664 for x64
x86 为 14c,x64 为 8664
n:>dumpbin lib642.lib /headers
Microsoft (R) COFF/PE Dumper Version
10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved.Dump of file lib642.lib
File Type: LIBRARY
FILE HEADER VALUES 8664 machine (x64
n:>dumpbin lib642.lib /headers
Microsoft (R) COFF/PE Dumper 版本
10.00.30319.01 版权所有 (C) Microsoft Corporation。版权所有。转储文件 lib642.lib
文件类型:图书馆
文件头值 8664 机器 (x64
Or
或者
n:>dumpbin Lib32.lib /headers
Microsoft (R) COFF/PE Dumper Version
10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved.Dump of file Lib32.lib
File Type: LIBRARY
FILE HEADER VALUES 14C machine (x86)
n:>dumpbin Lib32.lib /headers
Microsoft (R) COFF/PE Dumper 版本
10.00.30319.01 版权所有 (C) Microsoft Corporation。版权所有。转储文件 Lib32.lib
文件类型:图书馆
文件头值 14C 机器 (x86)