티스토리 뷰
cpp-lib-and-dll-on-visual-studio (2/2)
- previous post covers
- what LIB and DLL files are
- how to make LIB files
- how to use LIB files
- this post covers
- how to make DLL files
- how to use DLL files
- difference between LIB and DLL
- environment
- Windows 10 / Home
- Visual Studio 2017 / Community
make-dll
- open Visual Studio and make an empty solution
- add a new project by selecting
Windows Desktop Wizard
- select
Dynamic Link Library (.dll)
inApplication type:
combo box - uncheck
Precompiled Header
radio button
- you will get the screen like this
- make a header file and fill with the code above
- the macro determines whether the program will export DLL or import DLL
- fill the rest of the header
- make a source file and fill with the code above
- build solution and check the generated LIB and DLL files in output directory
use-dll
- open or make any project easy to include the library
- I recommend you to make
Empty Project
for convenience
- prepare any c/cpp file in the project
- you should add the LIB project path into
Additional Include Directories
in project property window- the path will be used for including header files
- in my case, the path is
D:\Code\VS2017\practice-dll\MathLibrary
- now you can include the header file
- you should add the LIB output path into
Additional Library Directories
in project property window- the path will be used for setting range of including LIB file
- in my case, the path is
D:\Code\VS2017\practice-dll\Debug
- you should add the LIB file name into
Additional Dependencies
in project property window- the name will be used for including certain LIB file
- in my case, the name is
MathLibrary.lib
- write the code above and build the solution
- check the generated executable file in output directory
- copy the DLL file into where the executable file is
- debug or run the program and you can see the result
wrap-up
references are here
in using LIB
- the program using library includes LIB file before executing itself
- this is why LIB method wastes the memory
- need for 3 main settings
- header file path
- LIB file path
- LIB file name
- structure
- LIB file contains implementation
- the program using LIB can run by itself
- the program using library includes LIB file before executing itself
in using DLL
- the program using library includes DLL file after executing itself
- this can help the program get lighter
- need for 4 main settings
- 3 main settings for LIB method
- locating DLL file into the same path with the executable file
- structure
- LIB file just indicates DLL file and DLL file contains implementation
- the program using DLL cannot run by itself
- the program using library includes DLL file after executing itself
'Programming > C+±' 카테고리의 다른 글
cpp-lib-and-dll-on-visual-studio (1/2) (0) | 2019.02.23 |
---|---|
SetCapture() GetCapture() ReleaseCapture() (2) | 2018.04.01 |
refresh in console program (0) | 2018.03.11 |
pause in console program (0) | 2018.03.08 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- WindowAPI
- Anaconda
- lib
- JIT
- ATOM
- windows
- A.I.
- pclaf
- unreal
- visual-studio
- visualstudio
- shader
- Docker
- tensorflow
- dll
- Slack
- DirectX
- CUDA
- Python
- C/C++
- csharp
- vscode
- NOX
- Hashtable
- CAFFE
- cuDNN
- unity
- git
- PopeTV
- Game
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함