Linux/C + + programming library

Source: Internet
Author: User

To build and use a linked library:
A static library is a collection of object file obj, a static library extension name. A static library generated by Ar-rcs

Static Library Benefits:
1, do not recompile the library code, re-link, save the compilation process time
2, developers can provide library files to use the personnel, not open source

3, generate a static link library, or add an obj file to a static library that already exists
AR library file name. A obj file 1 obj file 2 obj file n+
The most basic step in creating a static library is to generate the target file;

Dynamic Link Library

-soname,libstr.so represents the Build
Dynamic Library alias Libstr.so
Library name is Str
The library prefix is lib, and the suffix name is so
The-o libstr.so.1 option indicates the actual dynamic-link library file that generated the name
-shared tells the compiler to generate a dynamic-link library

Complete command for generating dynamic link libraries based on C source files

Gcc-shared-wl,-soname,libstr.so-o libstr.so.1 C source files need to generate dynamic library;

Creating a dynamic-link library is an important issue to install
Generally speaking, the generated dynamic link library is copied to the system's default dynamic link library's search path, usually/lib,/usr/lib,/usr/local/lib please note with our standard header file

Linux/C + + programming library

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.