Learn about Dynamic Links (1)-Overview and overview of Dynamic Links

Source: Internet
Author: User

Learn about Dynamic Links (1)-Overview and overview of Dynamic Links
I. disadvantages of static links

1. Memory and disk space waste

Assume that both module A and Module B depend on C and use static links. The C library is linked to database A and database B. In this way, whether Stored on disk or in memory, each module C has two copies.

2. Program maintenance troubles

Assume that the program depends on many libraries. If any of them modifies a bug or updates the program, you need to re-link and re-release the program.

2. Dynamic Link)

Delay the link process until it is run.

Assume that both module A and Module B depend on Module C and use dynamic links. At runtime, Module C only has one copy in the memory, which is shared by module A and Module B, there is only one independent C Shared library on the disk.

Dynamic Links are used to solve the two shortcomings of static links mentioned above.

The process of dynamic link is roughly to recursively load the dependent Library to the memory, then parse the symbol and relocate the address, and finally execute the entry point program.

3. Dynamic links are not perfect

1. Version Control of the Shared Library

The basic idea of dynamic link is to split the program into independent modules. A common problem is that after a module on which the program depends is updated, some original programs cannot run because the interfaces of the New and Old modules are incompatible.

2. Performance Loss

Dynamic Links are used to re-link the program each time it runs, which may cause some performance loss. Lazy Binding can minimize this performance loss.

4. How to quickly understand the entire process of Dynamic Links

The fastest way to learn is to read the code, such as reading the Linker code of the Android system. The entire Linker does not have a large amount of code, but the premise is to have a certain understanding of the ELF format.

Learning Materials: programmer self-cultivation-links, loading and libraries

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.