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
Release: 2024-12-27 05:48:13
Original
352 people have browsed it

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
Copy after login

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
Copy after login

readelf

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

readelf -Ws libz.so
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template