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++)

vince 學習筆記: C/C++ 製作 DLL 教學

 

文章標籤
全站熱搜
創作者介紹
創作者 yoruru 的頭像
yoruru

yoruru的努力日記

yoruru 發表在 痞客邦 留言(0) 人氣(324)