Home >Backend Development >C++ >How Can I List Exported Symbols from a Shared Library (.so File)?

How Can I List Exported Symbols from a Shared Library (.so File)?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-12-27 05:48:13317browse

How Can I List Exported Symbols from a Shared Library (.so File)?

Listing Symbols in a Shared Library (.so File)

To list the symbols exported from a shared library, a number of tools can be used.

nm

The nm utility lists symbols from object files and libraries. To list the symbols in a .so file using nm, use the following command:

nm -gD yourLib.so

objdump

If your .so file is in ELF format, you can use objdump to list its symbols. The -TC option can be used to display symbols and their types:

objdump -TC libz.so

readelf

Another option for listing ELF symbols is readelf. The -Ws option provides information about the symbol table:

readelf -Ws libz.so

Additional Options

  • -C: Demangles C symbols, making them more readable.
  • -g: Includes local as well as exported symbols.
  • -D: Lists only defined symbols.

The above is the detailed content of How Can I List Exported Symbols from a Shared Library (.so File)?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn