純C++的vector運用在DLL中的白痴範例
純C++的vector運用在DLL中的白痴範例
01.DLL_H
#ifndef __MAIN_H__ #include <windows.h> /* To use this exported function of dll, include this header #ifdef BUILD_DLL
#ifdef __cplusplus void DLL_EXPORT SomeFunction(const LPCSTR sometext); #endif // __MAIN_H__ |
02.DLL_CPP
#include “main.h” #include <iostream> // http://mropengate.blogspot.tw/2015/07/cc-vector-stl.html } extern “C” DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) case DLL_PROCESS_DETACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: |
03.EXE_CPP
#include <iostream> #ifdef BUILD_DLL
#ifdef __cplusplus int DLL_EXPORT initVar(); void Pause() |