Silmor . de
Site Links:
Impressum / Publisher

Getting Information about Program and Library Files

This is a list of function with which you can get information about the object and binary files on your system.

Linux and Unix

nm file
lists the symbols inside an object file (.o) or a (static) library (.a). It can also list symbols in shared objects (.so, .sl) and executables if they are not stripped.

ldd file
lists the dynamic libraries this library (.so) or executable binary depends on. If you add -Ur to it it will also try to process all relocations and dynamic linking and output errors if it finds any. If ldd doesn't find everything you might need to set the LD_LIBRARY_PATH variable.

objdump -x file
dumps the contents of the object file, library, or executable - including dynamic dependencies, imported and exported symbol names, and a ton of stuff only usable to people who know how the ELF format works. Objdump also works on executables from other platforms.

readelf -a file
parses the internal structures of ELF files (.o, .so, .sl, executables) and dumps them - exported symbols should be visible even if the file is stripped.

other candidates that I could not test on my system: dump, elfdump, dwarfdump

Windows

With Micro$ofts tools dumpbin /dependents app.exe will give you the DLLs the executable imports. The program might have more functions - I wouldn't know... (thanks to Dave Knopp to point this one out on qt-interest).

...you are invited to get lost in the MSDN on the search for more information...

With the GNU tools inside MinGW or Cygwin you will have more possibilities. The only tool not available is ldd, the others work as described above.

MacOS/X

On MacOS ldd is replaced by otool -L, it probably has more functions (which I can't verify having no Mac). More info can be found in Apples technotes. (Thanks to Daniel Walz for pointing this out on qt-interest)


Webmaster: webmaster AT silmor DOT de