17

I know that LD_LIBRARY_PATH is a environment variable where the linker will look for the shared library (which contains shared objects) to link with the executable code.

But what does the LD Stands for, is it for Load? or List Directory?

2 Answers 2

17

Linker. The *nix linker is called ld. When a program with dynamic libraries is linked, the linker adds additional code to look for dynamic libraries to resolve symbols not statically linked. Usually this code looks in /lib and /usr/lib. LD_LIBRARY_PATH is a colon separated list of other directories to search.

"ldd" is a handy program to see where the libraries are: try "ldd /bin/ls", for example.

It could also mean "Loader", though. ;-)

Editorial:

As a (semi) interesting side-note: I think dynamic libraries will go away someday. They were needed when disk space and system memory was scarce. There is a performance hit to using them (i.e. the symbols need to be resolved and the object code edited). In these modern days of 3GB memory and 7 second bootup times, it might be appropriate to go back to static linking.

Except for the fact that every C++ program would magically grow to 3MB. ;-)

10
  • 2
    The linker itself on a modern linux system will probably be /lib/ld-linux.so.2 or something similar to that. If you run that from the command line with no parameters you get a nice little help message.
    – bdk
    Nov 29, 2009 at 2:43
  • 1
    I doubt dynamic libs are going anywhere - it's very helpful to be able to patch a security hole by replacing one .so file, vs rebuilding every application in your OS that uses the library in question.
    – bdonlan
    Nov 29, 2009 at 2:59
  • 1
    <I think dynamic libraries will go away someday.> Remember that dynamic libraries also allow you to replace common code in one place and affect all the programs that use it. Sometimes this causes extreme problems, other times it is extremely useful. Nov 29, 2009 at 3:01
  • 4
    Dynamics libraries are not going anywhere. The fact that I can upgrade libpng.so, and suddenly all of the applications that use it are upgraded as well, is all too valuable. If there was a security vuln. in the libpng code, and all the programs that used it were statically linked, you would be SOL. Not the case with dynamic libraries files. Plus they save on disk space and memory. ("We have more" is not an excuse to waste.)
    – Thanatos
    Nov 29, 2009 at 3:37
  • 1
    I think what @Thanatos meant by "We have more" (although applicable to most computer resources) was that we have access to a lot more storage than we did back when dynamic libraries where first implemented. IMHO DL won't go away, there is an architectural and design reason for their existence, and it's just too valuable. Edit: we are not the first to argue about this, nor will we be the last ones. This discussion could go on forever.
    – acib708
    Feb 16, 2015 at 22:22
7

LD_LIBRARY_PATH - stands for LOAD LIBRARY PATH or some times called as LOADER LIBRARY PATH

1
  • Important to note: In this context, 'loader' = 'dynamic loader' = 'dynamic linker'(which is different from static linker)
    – starriet
    Feb 18, 2022 at 10:04

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.