Walkthrough: Create and use your own Dynamic Link Library (C++) using Visual Studio 2019
Prerequisites
- Visual Studio 2019
- Desktop development with C++ workload
Create the DLL project
Add .h file
Copy code from Microsoft docs.
Add .cpp file
Copy code from Microsoft docs.
Build Solution
Succeeded !!
Create a client app that uses the DLL
Right-click > Properties
Configuration Properties > C/C++ > General > Additional Include Directories edits the directory for MathLibrary.h
(path for MathLibrary.h)
Configuration Properties > Linker > Input > Additional Dependencies key in MathLibrary.lib
Configuration Properties > Linker > General > Additional Library Directories edits the directory for MathLibrary.lib
(path for MathLibrary.lib)
Modify MathClient.cpp: copy code from Microsoft docs.
Build -> Succeeded !!
Copy the .dll file to the same folder of the .exe file, then execute the MathClient.exe!
Reference:
Microsoft docs: Walkthrough: Create and use your own Dynamic Link Library (C++)