Create and Use DLL
- Create
1
2
3
4
5
6
7
8
9 |
//mydll.h
#ifdef BUILD_DLL
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
extern "C" int DLLEXPORT print(); |
cs |
1
2
3
4
5
6
7
8
9 |
//mydll.cpp
#include<iostream>
#include "mydll.h"
extern "C" int DLLEXPORT print(){
std::cout<<"This is My Dll"<<std::endl;
} |
cs |
1
2 |
g++ -c -DBUILD_DLL mydll.cpp
g++ -shared -o mydll.dll mydll.o |
cs |
- Use
'C&C++' 카테고리의 다른 글
WINAPI GetClipboardData() (0) | 2018.05.17 |
---|---|
Parameter Split in WinMain (Argc, Argv) (0) | 2018.05.10 |
C++ WinSock Sample Code (0) | 2018.04.09 |
swap using exclusive-or (0) | 2017.02.15 |
2048 게임만들기 (0) | 2017.02.08 |