The advantages and disadvantages of static libraries and the realization of dynamic libraries

The advantages and disadvantages of the
static library : the static library will copy all the function declarations and implementations in the static library to the .exe file when the function is compiled. If the .lib file is deleted in this way, the .exe file can be run, but if the .lib file Occupies a large amount of memory, which will cause a large .exe file and waste memory and resources
Insert picture description here
Insert picture description here
Insert picture description here

The creation and use of dynamic libraries under windows

Insert picture description here
For example, there are 500 function declarations and implementations in the dynamic library. When the first and fifth functions are used when the program is running, it will go to the dynamic library to find the implementations of the first and fifth functions, and then Link, put the implementation of the first and fifth functions into the .exe file.

If it is a static library, it will put all the implementations of the 500 functions in the static library into the exe file when the program is compiled

Dynamic library creation

Insert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
After setting it as a dynamic library, you need to regenerate it
Insert picture description here

Insert picture description here
Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/m0_53157173/article/details/114171781