Using DLL to make two projects share part of the code
Source: Internet
Author: User
Recently I have worked with my colleagues to develop a multi-process software. My colleagues write HMI (Interface) processes and I write COMM (Communication) processes. HMI provides read/write interfaces for shared memory. Both COMM and HMI use this interface to write the shared memory.
My COMM project needs to use interface functions provided by the HMI project. At this time, there are two options:
1. Copy the relevant files from the HMI project to the COMM project for compilation. One disadvantage of this approach is that every time the HMI project updates these interface functions, the COMM project must re-copy the code, integrate and compile new executable files, which is very inconvenient.
2. Generate the library file. The HMI designer establishes a new dynamic link library DLL project, copies the interface-related code to the DLL project, and generates a DLL library file. COMM Project
Copy the generated. dll file. lib and. H files to the project directory. In the Project --> Settings --> Link
Object/library
Add the. lib file name to modules and introduce the. h header file as needed. In this way, after the HMI project modifies the interface implementation, only the. dll and. lib files are required in the COMM project.
You can.
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.