Paul C
Paul C

Reputation: 8497

How to programmatically find the version of a loaded shared library?

I know I can get the version of some linux shared libraries just by running it. e.g.

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.

I also can get the loaded shared libraries programmatically in a running process using dl_iterate_phdr(3).

How can I get the version information programmatically?

Upvotes: 0

Views: 1097

Answers (1)

Piotr G
Piotr G

Reputation: 1028

Maybe this will help: https://unix.stackexchange.com/questions/58846/viewing-linux-library-executable-version-info

Basically, ELF contains field SONAME which tells the library name with the major version.

Upvotes: 1

Related Questions