Quote:
Originally Posted by
Praveen_218
Wherein we also provide a path for nm to look into, isn't it?
If you don't know the library you want, gcc doesn't either. -L only tells gcc where to get files from, it still expects names given with -l for it to link anything at all. It never trawls. Of course trawling with nm is slower.
Quote:
There were times when I've used altogather a new APIs by just looking at header files declerations and searched the relevant *.a file path to be included into the makefile. gcc was extremely quick to locate the relevant libxxx.a file (out of a number of such archieves) to add the correct library without significantly impairing the overall build time.
It's still not psychic. It doesn't know that -lz means zlib, and doesn't know what symbols -lz is supposed to supply. It just knows that -lz means libz.a/libz.la/libz.so/etc. There is a 1:1 correlation between library names and library files, it doesn't have to hunt -- it already knows what it wants, which is precisely what you told it.
Meaning, if you can compile with gcc, you already know what exact file you want, which is of course more efficient than trawling hundreds of files hunting for a symbol.