refer:http://bbs.csdn.net/topics/330158874
view dynamic Library files for elf files: ldd < file name > dynamic library file
You can extract a lot of functions if you have enough time to extract the associated static libraries linked to the GCC compiler when using AR. In contrast to the function in your *.h. Find out who belongs to WHO.
when I encounter a function that does not know which library it belongs to, I will first look for the package to which the header file belongs, and then look at the. A or. so file for that package (or the related package), and then:
objdump-x Library File | grep function name
1, man htons, the inside is talking about arpa/inet.h;
2. Suppose you are using an RPM type system: Rpm-qa--filesbypkg | grep arpa/inet.h, you see one or several packages providing this file, and now I see Glibc-headers (RHEL5)
3, it seems that this glibc-headers is just a package containing header files, to see what other similar packages are: Rpm-qa | grep glibc
4, I saw the Glibc,glibc-devel,glibc-common, I think Glibc-devel is certainly to provide. A (static link)
5, Rpm-q--filesbypkg glibc-devel| grep \.a$ | awk ' {print $} ' |xargs grep htons find all static library files with htons
6. Only one:/USR/LIB/LIBC.A
7, if there are several words, use objdump-x to look at the symbol table
To say a few words-on the Debian type of machine with dpkg or apt-files is a similar process, sometimes need some common sense or speculation, such as *-devel package is to provide header files and static link library, the corresponding non--devel package is provided. So.
If you want to find a shared library that is loaded by a running process, you can use the PLDD command, which shows all the shared objects that were loaded into a process at run time. sudo pldd <PID>
Alternatively, you can choose a command-line tool called Pmap. It reports the memory mapping of a process and also shows the library file dependencies of the running process. sudo pmap <PID>
How to view library files for Linux functions