Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print a list of symbols exported from a dynamic library

Tags:

macos

dylib

People also ask

How do I find exported symbols in Linux?

We can use the readelf command with the -s flag to view exported symbols: $ readelf -s lib.so Symbol table '.

How do I get symbols in .so files?

Try adding -l to the nm flags in order to get the source of each symbol. If the library is compiled with debugging info (gcc -g) this should be the source file and line number.

What are library symbols?

A symbol library is a collection of symbols. Typically the symbols in a symbol library belong to a specific group or correspond to a specific standard. Symbol libraries can be stored in a project or in a master data pool.


man 1 nm

https://web.archive.org/web/20160316222941/https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/nm.1.html

For example:

nm -gU /usr/local/Cellar/cairo/1.12.16/lib/cairo/libcairo-trace.0.dylib

Use otool:

otool -TV your.dylib

OR

nm -g your.dylib

Use nm -a your.dylib

It will print all the symbols including globals