[PLUG] UBUNTU c/c++ library

Galen Seitz galens at seitzassoc.com
Fri Feb 20 17:14:16 UTC 2009


rich wrote:
> Is there any way to see what functions, subroutines and header files are
> in the c/c++ library?
> 

nm will show you all of the symbols in a library.  I don't think it's 
possible to get any header file information, although there might be 
some information in the debug version of the library.

Display all of the symbols in the .text section:
  nm /lib/libc.so.6 | grep ' T '

...

I just learned something new.  On my CentOS 5.2 machine, 
/usr/lib/libc.so is not a link to the library, it's a linker script.

galens at toto:~$ cat /usr/lib/libc.so
/* GNU ld script
    Use the shared library, but some functions are only in
    the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( 
/lib/ld-linux.so.2 ) )

So it looks like you may need to examine multiple library files in 
order to see all the symbols.

-- 
Galen Seitz
galens at seitzassoc.com



More information about the PLUG mailing list