Dynamic link library: As the name implies, the library is loaded dynamically when the program runs. Some modules in the program are published in a dynamic-link library, which effectively reduces the capacity of the executable file (. exe) and separates the modules from the program. The most important thing when using a dynamic-link library is the. h header file. lib import file. dll file:. h files include declarations of classes or variables,. lib files include the symbolic name of the variable or function exported by the DLL, and the DLL file contains the actual functions and data for that DLL.
In the case of a dynamic library, when you compile the connection and execute the file, you only need to connect to the DLL's drop-down file, and the function code and data in the DLL are not copied to the executable file until it is run, to load the required DLL and map the DLL to the address space of the process. Then access the exported function in the DLL
When you create a DLL in VS2010, you can select the DLL project under the console project and add the. h and. cpp files to compile. The compiled. Lib and. h files are copied to the destination project, and the generated. dll files are placed in the same directory as the debug EXE, enabling the program to load dynamically.
Note: For the function or variable to be exported, remember to add __declspec (dllexport) to the variable or function declaration to indicate that the function or variable is to be exported.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Creating and using dynamic-link libraries under windows