Win32 console program calls DLL

Source: Internet
Author: User

The main steps are as follows:

1. Create a new dynamic link library project and add the class declaration and definition files to it;

Note that the declspec (dllexport) modifier must be used in the declaration of class member functions. This modifier can export methods in this DLL for other applications.Program.

2. Create an application that references the dynamic link library;

To use a member function created in the dynamic link library, you must reference the dynamic link library. Select the project that calls the DLL, select "Reference" from the "project" menu, and find the project directory corresponding to the dynamic link library.

To reference the header file of the dynamic link library, you must modify the directory path. Find the path of the DLL header file in "add include directory.

The executable file only loads the dynamic link library at runtime. You must tell the system where to find the DLL and use the PATH variable to point out the path of the. dll file.

3. In the application that calls the DLL, use the member function in the Custom DLL just like other DLL provided by the system.

Follow the steps in msdn:

Http://msdn.microsoft.com/zh-cn/vstudio/ms235636.aspx

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.