What is the search paths for shared object when running an execuable?

I hope the directory containing the executable is in the highest priority.
But I bet it is not searched at all.
 
By default, it's not (for security reasons); ldconfig() controls a cached list of all the "safe" shared objects that will be searched when looking for one.

One can use the LD_LIBRARY_PATH environment variable as described in ldconfig() to add to the locations searched.
 
Code:
The [B]ldconfig[/B] utility is used to prepare a set of ``hints'' for use by the
  dynamic linker to facilitate quick lookup of shared libraries available
  in multiple directories.  It scans a set of built-in system directories
  and any [I]directories[/I] specified on the command line (in the given order)
  looking for shared libraries and stores the results in a system file to
  forestall the overhead that would otherwise result from the directory
  search operations the dynamic linker would have to perform to load the
  required shared libraries.

This is a part of description of ldconfig(8), so the system directory is in higher priority.
Though "-s" option can be used to exclude system directories for searching, it can not be in lower priority.

Just not perfect.

BTW, the description in man is such a long sentence, not UNIX style some way.
BTW, why there is an additional "()" when using [MAN][/MAN] in the post?
 
Last edited by a moderator:
BTW, the description in man is such a long sentence, not UNIX style some way.
Not sure I agree, there are other manualpages which contain long sentences. The primary objective should be to relay the required information, which I think is happening here ;)

BTW, why there is an additional "()" when using [MAN][/MAN] in the post?
Because a manualpage normally also has a section, which you forgot to mention. So when talking about ldconfig I'd use: ldconfig(8). Or to show the source: [man=8]ldconfig[/man]. Hope this helps.
 
Back
Top