views:

195

answers:

2

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?

+3  A: 

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. ;-)

Richard Pennington
Thanks very much :D
Marcos Roriz
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
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
<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.
binarycoder
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
Actually, we don't have more. Just because it makes it easier for a lazy sysadmin to fix a security hole doesn't guarantee that shared libraries will survive. New programs and algorithms constantly strain the limits of our systems.By the way, I labelled the last part of my answer "Editorial" for a reason. It is an opinion. My opinion of the future. The answer still stands.
Richard Pennington
A: 

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

Venkataramesh Kommoju