Linux dynamic library Analysis

Source: Internet
Author: User
Article Title: Linux operating system dynamic library analysis. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Is the shared library with Dynamic Links GNU/Linux? . This library allows executable files to dynamically access external functions at runtime, so as to reduce their overall memory usage (by introducing functions only when needed. This article studies the process of creating and using static databases, describes in detail the various tools for developing them, and reveals how these libraries work.

Library is used to package similar functions in a unit. These units can then be shared by other developers, and therefore have the idea of Modular programming-that is, building a program from a module. Linux supports two types of libraries, each of which has its own advantages and disadvantages. Static libraries include functions statically bound to a program during compilation. The dynamic library is different. It is loaded when the application is loaded, and it is bound to the application at runtime. Figure 1 shows the hierarchy of libraries in Linux.

Figure 1. Library hierarchy in Linux
 

There are two ways to use the Shared Library: You can dynamically link the library at runtime, you can also dynamically load the library and use them under program control. This article discusses both methods.

Static libraries are more suitable for small applications because they only require minimal functions. For applications that require multiple databases, shared libraries are suitable because they can reduce the memory usage (including disk usage and memory usage) of applications. This is because multiple applications can use a shared library at the same time. Therefore, you only need to copy one library in the memory at a time. For a static library, each running program must have a copy of the database.

GNU/Linux provides two methods to process shared libraries (each method is derived from Sun Solaris ). You can dynamically link the program to the shared library and let Linux load the library during execution (if it is already in memory, it does not need to be loaded ). Another method is to use a process called dynamic loading, so that the program can selectively call functions in the library. With the dynamic loading process, the program can first load a specific Library (not required if it has been loaded), and then call a specific function in the Library (Figure 2 shows the two methods ). This is a common method for building plug-ins-enabled applications. I will discuss and demonstrate this application programming interface (API) later in this article ).

Figure 2. Static and Dynamic Links
 

[1] [2] [3] [4] [5] Next page

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.