From 7e4512fa681192f17041dd01c6178e8195e6a2d5 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Fri, 4 Sep 2009 14:04:45 +0000 Subject: [PATCH] Better approach to handle C++ on Windows. Thanks to Fkooman. --- src/defines.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/defines.h b/src/defines.h index 8dfdf03..5a65c49 100644 --- a/src/defines.h +++ b/src/defines.h @@ -41,20 +41,24 @@ typedef void* dev_spec; // Device connection specification #define WARN(x, ...) printf("WARNING: " x "\n", ## __VA_ARGS__ ) #define ERR(x, ...) printf("ERROR: " x "\n", ## __VA_ARGS__ ) -#if defined __cplusplus - #define LIBNFC_EXPORT extern "C" +#if defined __cplusplus + #define LIBNFC_EXTERN_C extern "C" #else - #ifdef _WIN32 - #ifdef nfc_EXPORTS - #define LIBNFC_EXPORT __declspec( dllexport ) - #else - #define LIBNFC_EXPORT __declspec( dllimport ) - #endif - #else - #define LIBNFC_EXPORT - #endif + #define LIBNFC_EXTERN_C #endif +#ifdef _WIN32 + #ifdef nfc_EXPORTS + #define LIBNFC_DECLSPEC __declspec( dllexport ) + #else + #define LIBNFC_DECLSPEC __declspec( dllimport ) + #endif +#else + #define LIBNFC_DECLSPEC +#endif + +#define LIBNFC_EXPORT LIBNFC_EXTERN_C LIBNFC_DECLSPEC + //#define MIN(a,b) (((a) < (b)) ? (a) : (b)) //#define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define INNER_XOR8(n) {n ^= (n >> 4); n ^= (n >> 2); n ^= (n >> 1); n &= 0x01; }