Reprinted from: http://www.cnblogs.com/dawen/archive/2010/09/22/1833031.html
Terms:
- Dynamic Link Library
- Static Link Library
- Dynamic Link
- Static Link
The dynamic link library and static Link Library represent the files of the library, while the dynamic link and static link represent the Link Method of the program to the files of the Library;
Modular programming has gone through the "no database-> static database-> dynamic database" Stage
Dynamic and Static libraries are both code repositories that provide external variables, functions, or classes. Therefore, in a program, different modules can be implemented in the form of library files, so that they can only be provided to external interfaces.
The file name suffix of the dynamic link library is DLL, and the file name suffix of the static Link Library is Lib. Some comrades may wonder: when using the dynamic link library, there are also lib files, in fact, this lib file is only the DLL export description, that is, the import and export.
Differences in Connection Methods:
The static link method is to copy the contents of the library file to the target program, that is, the operation is completed during the link. From the behavior of the static link method, it is applicable to static link libraries.
The dynamic link method is to dynamically load library files at runtime. From the behavior of the dynamic link method, it is applicable to the dynamic link library, and its call method is to run the loadlibrary function; in the program, the loadlibrary function is used to call all the dynamic link libraries. In this case, you may have some questions: when using the dynamic link library for outbound Library (LIB, didn't use the loadlibrary function ?? There are two concepts involved: explicit and implicit loading of the dynamic link library. by calling the loadlibrary function in the program code, it is the display loading method, by using the import/export method, this is the implicit loading method. I personally think that in the implicit loading, the loadlibrary function is used to load the dynamic link library, so where is the loadlibrary function in the implicit loading method? In fact, it is in the export library of the dynamic link library.