Click to See Complete Forum and Search --> : Libraries


yawningdog
02-01-2002, 08:10 PM
I'd like to discuss libraries a bit. I'm guessing they reside in the compiler software somewhere. How can I find out what functions are in the various (sundry) libraries out there, and what they each do?

bwkaz
02-01-2002, 11:41 PM
Libraries are in a few different places. Ones that you'd need to boot (i.e. before /usr is mounted, becasue it may be a separate partition) are in /lib. Others are in /usr/lib, and anything that isn't controlled by a package manager should be in /usr/local/lib (note that this applies to not just libraries -- anything a package manager installs should be under /usr/bin, /usr/share/man, etc., and anything not installed with a package manager, like compiled from source, should be in /usr/local/bin, /usr/local/share/man, etc.).

Anyway, once you know the functions, they should all have man pages (assuming the library was installed correctly, and the library's developer isn't stupid). Just run man on the function name, and it should tell you what it does.

But as to how you'd find which functions are in a given library, I'm not sure. You may be able to just dump it to a console, but this may also screw up the console (binary data can have this effect). If it doesn't screw anything up, the exported symbols should be near the end. You could also look for a web page on the library (e.g. ncurses has some howtos on the web, etc.).

There may be some utility in binutils to dump all the symbols, but I can't think of it offhand.

Qubit
02-02-2002, 07:49 AM
'nm' gives you the symbols for a static library. Bwkaz is right, it's part of the binutils package.

Not to sure how to do it with a shared lib, though.

You could always dump the string table with 'strings'...

[ 02 February 2002: Message edited by: Glaurung ]