当前位置:网站首页>The difference between static library and dynamic library of program
The difference between static library and dynamic library of program
2022-07-29 07:32:00 【jaky_】
Functions are code blocks that can be reused throughout the program . Using them can save time , No need to rewrite the code many times . Same as function , Libraries can also save time , Because they enable functions to be reused in multiple programs .
A static library or static link library is a set of routines , External functions and variables , They are parsed in the caller at compile time , And by the compiler , The linker or binder is copied to the target application , Thus, the object file and an independent executable file are generated . Dynamic links only include the address of the Library ( Static links are a waste of space ) Dynamic links link libraries at runtime .
Although static libraries can be reused in multiple programs , But it will be locked into the program at compile time . On the other hand , Dynamic or shared libraries exist as separate files from executable files .
The disadvantage of using a static library is that its code is locked into the final executable , It cannot be modified without recompiling . contrary , Dynamic libraries can be modified without recompiling .
Because the dynamic library is outside the executable , Therefore, the program only needs to make a copy of the library file at compile time . Using a static library means that every file in the program must have its own copy of the library file at compile time .
The disadvantage of using dynamic libraries is that programs are easier to break . for example , If the dynamic library is damaged , Then the executable may no longer work . however , Static libraries are inaccessible , Because it exists in the executable .
The benefits of using dynamic libraries are , Multiple running applications can use the same library , Instead of requiring each application to have its own copy .
Another advantage of using static libraries is the execution speed of the runtime . Because its object code ( Binary system ) Already included in the executable , So calls to multiple functions can be processed faster than dynamic library code , The code of the dynamic library needs to be called from a file other than the executable .
When to use them ?
If you have many documents , Multiple copies of the static library mean that the size of the executable file increases , Then it is recommended to use dynamic library , Can save time . If the benefits of execution time outweigh the need to save space , Then static library is the best choice .
边栏推荐
- Scala 高阶(九):Scala中的模式匹配
- 08 dynamic programming
- ef core 读取text类型慢_ef core读取大字符串字段慢
- A long article --- in-depth understanding of synchronized
- Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays
- PAT甲级 1150 旅行商问题
- Docker's latest super detailed tutorial - docker creates, runs, and mounts MySQL
- webapi接口文件下载时跨域问题
- [daily question in summer] Luogu p6408 [coci2008-2009 3] pet
- I'd like to ask, my flick job writes data in the way of upsert Kafka, but I'm more careful in MySQL
猜你喜欢

Thinkphp6 realizes database backup
Scala higher order (IX): pattern matching in Scala

Spingboot integrates the quartz framework to realize dynamic scheduled tasks (support real-time addition, deletion, modification and query tasks)

QT连接两个qslite数据库报错QSqlQuery::exec: database not open

Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays
![[summer daily question] Luogu p7760 [coci2016-2017 5] tuna](/img/9a/f857538c574fb54bc1accb737d7aec.png)
[summer daily question] Luogu p7760 [coci2016-2017 5] tuna

Meeting notice of OA project (Query & whether to attend the meeting & feedback details)

0 9 布隆过滤器(Bloom Filter)

JS day 4 process control (if statement and switch statement)

QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例
随机推荐
Round avatar of user list and follow small blocks
[summer daily question] Luogu p6320 [coci2006-2007 4] sibice
[daily question in summer] Luogu p6408 [coci2008-2009 3] pet
ef core 读取text类型慢_ef core读取大字符串字段慢
【Unity实战100例】Unity万能答题系统之单选多选判断题全部通用
计算程序运行时间 demo
Scala 高阶(十):Scala中的异常处理
蓝桥杯A组选数异或
如何与斯堪尼亚SCANIA建立EDI连接?
What is the function of fileappender in logback?
logback appender简介说明
[MySQL] - [subquery]
Dilworth 定理
Paper reading (62):pointer networks
LevelFilter简介说明
Leetcode 209. subarray with the smallest length (2022.07.28)
Getting started with JDBC
亚马逊云助手小程序来啦!
Prometheus与Grafana
PAT甲级 1150 旅行商问题