I was trying to understand how symbols are resolved in case of dynamically loaded libraries. I observed that the symbols of the libraries are resolved using the libs linked as the dynamic dependencies to the library. The same can be listed using - ldd <share_file_name.so>
Is this correct?
Earlier I assumed that the loader will look at the LD_LIBRARY_PATH
and will look at all the libraries for resolving the symbols in the library.
But now I think about it then I can see why this approach might not be used. The reason is that it will be very in-optimised way of resolving the symbols if the loader has to look at all the libraries at the directories listed in the LD_LIBRARY_PATH
. What if the directory has a million files then it will be very slow as any file can have the symbol.