basic concept
static library
The suffix is .lib file under windows and .a file under Linux.
When compiling, you need to include the interface header file and static library, and the code will be compiled directly into the executable file. The advantage is that the runtime does not depend on static library files. However, when the compiled file is large, and the static library method is changed, all projects that depend on this file need to be recompiled
dynamic library
The dynamic library contains files with the suffix .lib and .dll under Windows. The .lib file is an import library, which does not contain code, but provides information for the linker, including the relocation table to be used when establishing a dynamic link in the .exe file.
The import library is used for program development, and the dynamic library is used for program runtime.
Dynamic libraries are divided into explicit calls and implicit calls:
Implicit call
When compiling, include import libraries and interface header files. At runtime, the dynamic library needs to be included, otherwise an error will be reported. Implicit call coding is simple, but all dynamic libraries will be loaded into memory at startup, which will waste resources.
explicit call
When compiling, no import library and interface files are required. At runtime, the dynamic library is loaded only when needed, so it is more flexible.
Need to use in Linux
dlopen(), dlsym(), dlclose() three functions
Need to use under windows
LoadLibrary, GetProcAddress, FreeLibrary three functions load dynamic library
refer to:
https://www.cnblogs.com/westsoft/p/5936092.html
https://blog.csdn.net/star_xiong/article/details/17301191