【问题标题】:How to programmatically find the version of a loaded shared library?如何以编程方式查找已加载共享库的版本?
【发布时间】:2017-08-07 17:36:10
【问题描述】:

我知道我可以通过运行一些 linux 共享库来获得它的版本。例如

bash$ /lib/x86_64-linux-gnu/libc.so.6

GNU C Library (Ubuntu GLIBC 2.23-0ubuntu9) stable release version 2.23, by Roland McGrath et al.

我还可以使用dl_iterate_phdr(3) 在正在运行的进程中以编程方式获取加载的共享库。

如何以编程方式获取版本信息?

【问题讨论】:

  • 你的运行技巧只适用于 libc。您可以使用 rpm 或 dpkg 查看软件包版本。

标签: c++ c linux shared-libraries


【解决方案1】:

也许这会有所帮助: https://unix.stackexchange.com/questions/58846/viewing-linux-library-executable-version-info

基本上,ELF 包含字段 SONAME,它告诉库名称和主要版本。

【讨论】:

    猜你喜欢
    • 2021-09-24
    • 1970-01-01
    • 2013-07-17
    • 1970-01-01
    • 2012-05-19
    • 1970-01-01
    • 2014-09-02
    • 1970-01-01
    • 2013-07-01
    相关资源
    最近更新 更多