Static and Dynamic library creation and use

Source: Internet
Author: User
The essence library is a binary format of executable code. It can be loaded into the memory and executed in two types: static library and dynamic library.
I. Concept
The name of the static function library is generally the link of libxxx. A function library, which is used to link all related objects during compilation and the function library involved to form an executable file. It is no longer related to the function library.
The name of the dynamic function library is generally libxxx. So.
II. Advantages and disadvantagesThe disadvantage of the static function library is that the file is large, which wastes the space library or changes to the program.
The advantage file of the dynamic function library is small, saving space. The Library is public, and there is always only one code in the memory.
III. Static and Dynamic Link Library Creation


2. Create and use static databases.


3. Create and use a dynamic library.


-L path of the library file to be loaded.-lfun indicates the name of the library file.
Static create static Link Library. Shared create dynamic link library.

4. Find the dynamic library Method
1. Copy the Library to the/usr/lib and/lib directories.
2. Add the path to the library in the LD_LIBRARY_PATH environment variable. Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/c_pram/practice/lib/
3. Modify the/etc/lD. So. conf file, add the path of the Library to the end of the file, and execute sudo ldconfig to refresh.

V. . View symbols in the library
You can use LDD to view which libraries the executable files depend on.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.