Static library, dynamic library comparison

Source: Internet
Author: User

1 Advantages of the static link library

(1) The Code loading speed is fast, the execution speed is slightly faster than the dynamic link library;

(2) Just make sure you have the right one on the developer's computer. LIB file, you do not need to consider on the user's computer when you publish the program in binary form. LIB file exists and version problem, can avoid DLL hell and so on.

2 Advantages of the dynamic link library

(1) Save more memory and reduce page switching;

(2) DLL file and EXE file independent, as long as the output interface is unchanged (that is, the name, parameters, return value type and calling convention unchanged), the replacement DLL file will not have any impact on the EXE file, thus greatly improving the maintainability and extensibility;

(3) programs written in different programming languages can call the same DLL function just according to the function calling convention;

(4) Suitable for large-scale software development, make the development process independent, the coupling degree is small, facilitates the development and the test between different developer and the development organization.

3 deficiencies

(1) The executable file generated by using static link is large in size and contains the same common code, resulting in waste;

(2) The application using the dynamic link library is not self-sufficient, it depends on the DLL module to exist, if the use of dynamic link loading, the program started to find that the DLL does not exist, the system will terminate the program and give an error message. While using runtime dynamic linking, the system does not terminate, but because the exported function in the DLL is not available, the program fails to load, and the speed is slower than the static link. When a module is updated, if the new module is incompatible with the old module, then the software that needs the module to run is torn away. This is common in early windows.

Static library, dynamic library comparison

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.