Static library and dynamic library-the path to linux Program Design

Source: Internet
Author: User
Static library and dynamic library-the path to linux programming-general Linux technology-Linux programming and kernel information. For details, see the following. I am studying Program Design in linux recently and will write my learning experience on the way. I hope you can point out the shortcomings.

Linux has two types of function libraries: static library and dynamic library.

Static function library:
The class library name is generally libxxx. a. The files compiled using the static function library are relatively large, because all the data in the function library will be integrated into the target code, and its advantages are obvious, that is, the compiled execution program does not need the support of external function libraries, because all the functions used have been compiled. Of course, this will also become his shortcoming, because if the static function library changes, then your program must be re-compiled.

Dynamic function library:
The class library name is generally libxxx. so; compared with the static function library, the dynamic function library is not compiled into the target code during compilation, and the corresponding function in the function library is called only when your program executes the relevant function, therefore, the executable files generated by the dynamic function library are relatively small. Because the function library is not integrated into your program, but dynamically applied for and called when the program is running, the corresponding library must be provided in the running environment of the program. Changes to the dynamic function library do not affect your program, so it is easier to upgrade the dynamic function library.

In linux, there are several important directories for storing the corresponding function libraries, such as/lib/usr/lib.

The following describes how to create and use a linux static function library:

Routine str_out.h str_out.c main. c:
QUOTE:
Related Article

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.