Creating and using dynamic-link libraries under windows

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.