Three methods for loading a dynamic link library in Linux
Source: Internet
Author: User
Three methods for loading a dynamic link library in Linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. First, modify the system file:
In/etc/ld. so. the conf file specifies the default dynamic link library search path, my/etc/ld. so. the conf file contains include/etc/ld. so. conf. d /*. conf
That is to say, it indirectly specifies the file defining the path. We only need to add the required path to/etc/ld. so. conf. run ldconfig in any file in the d directory. However, to make it easy to understand, it is best to find a related file or create a new file, write the path to be added and run ldconfig
The second is to use the variable LD_LIBRARY_PATH:
Add the path to LD_LIBRARY_PATH. Note that if there are more than one path, separate it with a colon. For example, export LD_LIBRARY_PATH =/usr/local/lib/minigui
The third is set during compilation:
When compiling the source code, you can use the parameter-Wl and-rpath to specify the path for dynamic search.
I have used only two of the three methods, the first and the second.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service