티스토리 뷰
cpp-lib-and-dll-on-visual-studio (1/2)
- this post covers
- what LIB and DLL files are
- how to make LIB files
- how to use LIB files
- next 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
overview
- recap on c/cpp compilation
- when you compile a c/cpp code, the process above will be done
- we call the time during the process; compile-time
- and the time after the execution; run-time
- LIB file
- its file extension is
.lib
- ex)
cudart.lib
in CUDA 9.0 version
- ex)
- it is called static-link-LIBrary
- for the reason that linking on compile-time
- it is used for ease of execution
- by using LIB file, you only need to handle execution file
- its file extension is
- DLL file
- its file extension is
.dll
- ex)
cudart32_90.dll
in CUDA 9.0 version
- ex)
- it is called Dynamic-Link-Library
- for the reason that linking on run-time
- it is used for saving memory usage
- both main-memory(RAM) and auxiliary-memory(HDD or SSD)
- its file extension is
make-lib
- open Visual Studio and make an empty solution
- add a new project by selecting
Windows Desktop Wizard
- select
Static Library (.lib)
inApplication type:
combo box - uncheck
Precompiled Header
radio button
- make a header file and fill with the code above
- make a source file and fill with the code above
- build solution and check the generated LIB file in output directory
use-lib
- 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
Addtional Include Directories
in project property window- the path will be used for including header file
- in my case, the path is
D:\Code\VS2017\practice-lib\MathFuncsLib
- 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-lib\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
MathFuncsLib.lib
- write the code above and check out the output
- now you have used LIB file !
to-be-continued...
- next post will cover the rest of this topic
- make-dll
- use-dll
- comparison
'Programming > C+±' 카테고리의 다른 글
cpp-lib-and-dll-on-visual-studio (2/2) (0) | 2019.03.17 |
---|---|
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
- DirectX
- A.I.
- pclaf
- git
- dll
- Game
- PopeTV
- Python
- NOX
- Anaconda
- tensorflow
- cuDNN
- csharp
- unreal
- Docker
- ATOM
- CAFFE
- Slack
- lib
- CUDA
- JIT
- C/C++
- windows
- Hashtable
- unity
- WindowAPI
- vscode
- visualstudio
- visual-studio
- shader
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함