LFCS · Question #822
Which of the following environment variables overrides or extends the list of directories holding shared libraries?
The correct answer is C. LD_LIBRARY_PATH. The LD_LIBRARY_PATH environment variable is used in Linux to specify a colon-separated list of directories to be searched for shared libraries before the standard system directories.
Question
Options
- ALD_LOAD_PATH
- BLD_LIB_PATH
- CLD_LIBRARY_PATH
- DLD_SHARE_PATH
- ELD_RUN_PATH
How the community answered
(30 responses)- A3% (1)
- B3% (1)
- C87% (26)
- E7% (2)
Why each option
The `LD_LIBRARY_PATH` environment variable is used in Linux to specify a colon-separated list of directories to be searched for shared libraries before the standard system directories.
`LD_LOAD_PATH` is not a standard environment variable used for specifying shared library search paths in Linux.
`LD_LIB_PATH` is not the correct standard environment variable for this purpose; it is a common misspelling of `LD_LIBRARY_PATH`.
The `LD_LIBRARY_PATH` environment variable is specifically designed to override or extend the default search paths for dynamic linker/loader to find shared libraries, allowing users to test newer library versions or custom libraries without modifying system configurations. When an application attempts to load a shared library, the dynamic linker first checks the directories specified in this variable.
`LD_SHARE_PATH` is not a recognized environment variable for controlling shared library search paths.
`LD_RUN_PATH` is a linker option for embedding library search paths into an executable at compile time, not an environment variable for runtime overriding.
Concept tested: Linux shared library loading path
Source: https://man7.org/linux/man-pages/man8/ld.so.8.html
Topics
Community Discussion
No community discussion yet for this question.