Q: I'm lost with all those different libraries. How in the world
can I find out which functions are included in which library?
A: You can use the
nm program to check what functions are
included in a library. Run it with the
-C option and with the library
as its argument and look in the output for the name of your function (the
--demangle option makes the function names look
closer to what they are called in the source file). Functions which have
their code included in the library have a capital
T before their
name. For example, the following is a fragment from the listing produced by
c:\djgpp\lib> nm --demangle libc.a . . . stdio.o: 000000e4 b .bss 000000e4 d .data 00000000 t .text 00000098 t L12 0000001e t L3 00000042 t L6 0000004d t L7 0000006a t L9 00000000 t __gnu_compiled_c U _filbuf U _flsbuf 00000000 T clearerr 000000ac T feof 000000c2 T ferror 000000d8 T fileno 0000000c T getc 00000052 T getchar 0000002a T putc 0000007c T putchar 00000000 t gcc2_compiled. . . .
Here we see that the module
stdio.o defines the functions
putchar, and calls functions
_flsbuf which aren't defined on this module.
Alternatively, you can call
nm with the
--print-armap, which will print an index of what symbols are
included in what modules. For instance, for
libc.a, we will see:
c:\djgpp\lib> nm --print-armap libc.a . . . _feof in stdio.o _ferror in stdio.o _fileno in stdio.o . . .
which tells us that the functions
fileno are defined in the module
nm is fully described in the GNU docs. See GNU Binutils Manual.
|webmaster||delorie software privacy|
|Copyright © 2001 by Eli Zaretskii||Updated Apr 2001|