I have just built a shared lib on Ubuntu, and when I attempt to use the function, the application that loads the library is reporting 'xxx' symbol not found.
I want to check (i.e. list) the functions that are exported by my library so I can investigate this issue further.
Relevant details:
OS: Ubuntu 9.10 compiler: gcc 4.4.1 linker: GNU ld 2.20
We can use the readelf command with the -s flag to view exported symbols: $ readelf -s lib.so Symbol table '.
The flag -g is used to show only exported symbols. Show activity on this post. 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.
In Linux, to check whether a routine exists within a library file, use the nm command with the -g option, and pipe the output to grep .
Shared libraries are compiled code which is intended to be shared among several different programs. They are distributed as . so files in /usr/lib/. A library exports symbols which are the compiled versions of functions, classes and variables.
Try the nm utility.
GNU nm lists the symbols from object files objfile.... If no object files are listed as arguments, nm assumes the file a.out. [reference]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With