Featured image of post 如何查看库是32位还是64位?

如何查看库是32位还是64位?

背景

最近在使用golang通过cgo生成动态链接库时, 由于项目较多,很难记住当前使用的库的位数。 接下来就来介绍一下如何查看库是32位还是64位

linux

使用file命令查看库的位数。

1
file test.so

64位结果为:

1
test.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=8e8a0749c8efc6829f597e59eaba793513baf4a8, not stripped

32位结果为:

1
test.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=8e8a0749c8efc6829f597e59eaba793513baf4a8, not stripped

windows

  1. 使用file命令查看库的位数。
1
file test.dll

32位结果为:

1
test.dll: PE32 executable for MS Windows (DLL) (console) Intel 80386 32-bit

64位结果为:

1
test.dll: PE32+ executable for MS Windows (DLL) (console) Mono/.Net assembly
  1. 使用Nodepad++打开test.dll文件

在第二行找到PE,然后后面的L32位d64位

32位结果: 32位

64位结果:

64位

本博客已稳定运行
发表了78篇文章 · 总计132.15k字
本站总访问量 次 · 您是本站第 位访问者
粤ICP备2025368587号-1| 使用 Hugo 构建
主题 StackJimmy 设计