Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the difference between dynamic library and static library?

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what's the difference between dynamic library and static library". In daily operation, I believe that many people have doubts about the difference between dynamic library and static library. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the question of "what's the difference between dynamic library and static library"! Next, please follow the editor to study!

Differences: 1, static library extension is generally ".a" or ".lib"; dynamic library extension is generally ".so" or ".dll". 2. The static library will be directly integrated into the target program at the time of compilation, and the successfully compiled executable file can be run independently; the dynamic library will not be put into the connected target program at compile time, so the executable file cannot be run alone.

The operating environment of this tutorial: windows10 system, Dell G3 computer.

The most essential difference between a static library and a dynamic library is whether the library is compiled into the target (program).

Static (function) library

The general extension is (.an or .lib), and such libraries usually have the extension libxxx.an or xxx.lib.

This kind of library will be directly integrated into the target program at the time of compilation, so the file compiled by the static function library will be relatively large. The biggest advantage of this kind of function library is that the successfully compiled executable file can be run independently. There is no need to read the contents of the function library from the outside; but there is no obvious advantage in terms of the difficulty of upgrading. If the function library is updated, it needs to be recompiled.

Dynamic function library

Dynamic function libraries generally have the extension (.so or .dll), and such libraries are usually called libxxx.so or xxx.dll.

Unlike static libraries, which are captured throughout the program, dynamic libraries have only one "pointing" location in the program when compiled, that is, when the executable needs to use the library mechanism, the program reads the library to use; that is, the executable cannot be run alone. In this way, it is convenient to upgrade from the point of view of product function upgrade, as long as the corresponding dynamic library is replaced, and there is no need to recompile the entire executable file.

To sum up, we cannot see:

From the point of view of production, the released algorithm library or function library makes the dynamic library as much as possible, so it is convenient to update and upgrade, and there is no need to recompile the entire executable file, only the new version of the dynamic library can replace the old one.

From the point of view of function library integration, if all published sublibraries (more than one) are integrated into a dynamic library to provide interfaces, all sublibraries need to be compiled into static libraries, so that all sublibraries can be compiled into the target dynamic library. functions are provided by the final integrated library.

At this point, the study of "what's the difference between a dynamic library and a static library" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report