Static linking versus Dynamic Linking

Source: Internet
Author: User

 

If a copy of the libraries is physically part of the executable, then we say the executable has beenStatically linked.

If the executable merely contains filnames that enable the loader to find the program's library references at tuntime, then we say it has beenDynamically linked.

The canonical [authoritative, recognized] names for the three phases of collecting modules together and preparing them for execution areLink-editing, loading, and runtime linking.

Statically linked modules are link edited and then loaded to run them.

Dynamically linked modules are link-edited and then loaded and runtime-linked to run them. at execution, before Main () is called, the runtime loader brings the shared data objects into the process address space. it doesn't resolve external function calluntil the call is actually made, so there's no penalty to linking against a library that you may not call.

The two linking methods are compared in next figure:

 

 

 

Dynamic Linking is the more modern approach, and has the advantage of much smaller executable size. dynamic Linking trades off more efficient use of the disk and a quicker link-edit phase for a small runtime penalty.

 

One purpose of Dynamic Linking is the Abi

A major purpose of Dynamic Linking is to decouple programs from the particle library versions they use. instead, we have the Convention that the system provides an interface to programs, and that this interface is stable over time and successive OS releases.

Programs can call services promised by the interface, and not worry about how they are provided or how the underlying implementation may change.

Because this is an interface between application programs and the services provided by library binary executables, we call it an application binary interface or Abi.

 

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.