From cabfab0ee75f6637fcf93f2597e53891270a8da7 Mon Sep 17 00:00:00 2001 From: Shih-Chin Date: Sun, 12 Oct 2014 14:37:14 +0800 Subject: [PATCH] Add a KCBV2_STATIC symbol for static lib compilation --- KCBv2/KCBv2Lib.h | 14 +++++++++----- KCBv2/dllmain.cpp | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/KCBv2/KCBv2Lib.h b/KCBv2/KCBv2Lib.h index 65e7425..4024eb3 100644 --- a/KCBv2/KCBv2Lib.h +++ b/KCBv2/KCBv2Lib.h @@ -24,12 +24,16 @@ See the Apache 2 License for the specific language governing permissions and lim #include // will need $(KINECTSDK20_DIR)inc; in the includes directory for project #ifdef WIN32 - #ifdef KCBV2_EXPORTS - #define KINECT_CB __declspec(dllexport) + #ifdef KCBV2_STATIC + #define KINECT_CB #else - #define KINECT_CB __declspec(dllimport) - #pragma comment (lib, "KCBv2") // add $(KINECTSDK20_DIR)lib\x64 or x86 to the library directory for project - #endif // DLL_EXPORTS + #ifdef KCBV2_EXPORTS + #define KINECT_CB __declspec(dllexport) + #else + #define KINECT_CB __declspec(dllimport) + #pragma comment (lib, "KCBv2") // add $(KINECTSDK20_DIR)lib\x64 or x86 to the library directory for project + #endif // DLL_EXPORTS + #endif // !KCBV2_STATIC #endif //_WIN32 #ifndef __KCB_HANDLE__ diff --git a/KCBv2/dllmain.cpp b/KCBv2/dllmain.cpp index 8a4d94c..3c02429 100644 --- a/KCBv2/dllmain.cpp +++ b/KCBv2/dllmain.cpp @@ -15,6 +15,7 @@ See the Apache 2 License for the specific language governing permissions and lim // dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" +#ifndef KCBV2_STATIC BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, LPVOID /* lpReserved */) { switch (ul_reason_for_call) @@ -27,4 +28,4 @@ BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, LPVOID /* } return TRUE; } - +#endif \ No newline at end of file