From 6ab664485acda2785795aaace86b2251764cc03a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Sun, 20 Oct 2013 15:24:58 +0200 Subject: [PATCH] Win32 DLL support for libpaysages_system --- src/system/Mutex.h | 10 +++++----- src/system/Thread.h | 8 ++++---- src/system/system_global.h | 22 ++++++++++++++++------ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/system/Mutex.h b/src/system/Mutex.h index 1ca2312..eaffe17 100644 --- a/src/system/Mutex.h +++ b/src/system/Mutex.h @@ -15,7 +15,7 @@ namespace system /*! * \brief System mutex */ -class Mutex: private QMutex +class SYSTEMSHARED_EXPORT Mutex: private QMutex { public: /*! @@ -39,10 +39,10 @@ extern "C" { typedef struct Mutex Mutex; #endif -Mutex* mutexCreate(); -void mutexDestroy(Mutex* mutex); -void mutexAcquire(Mutex* mutex); -void mutexRelease(Mutex* mutex); +SYSTEMSHARED_EXPORT Mutex* mutexCreate(); +SYSTEMSHARED_EXPORT void mutexDestroy(Mutex* mutex); +SYSTEMSHARED_EXPORT void mutexAcquire(Mutex* mutex); +SYSTEMSHARED_EXPORT void mutexRelease(Mutex* mutex); #ifdef __cplusplus } diff --git a/src/system/Thread.h b/src/system/Thread.h index ccb8b79..46d575f 100644 --- a/src/system/Thread.h +++ b/src/system/Thread.h @@ -17,7 +17,7 @@ namespace system /*! * \brief System thread */ -class Thread: private QThread +class SYSTEMSHARED_EXPORT Thread: private QThread { public: /*! @@ -61,10 +61,10 @@ extern "C" { typedef struct Thread Thread; #endif -Thread* threadCreate(ThreadFunction function, void* data); -void* threadJoin(Thread* thread); +SYSTEMSHARED_EXPORT Thread* threadCreate(ThreadFunction function, void* data); +SYSTEMSHARED_EXPORT void* threadJoin(Thread* thread); -void timeSleepMs(unsigned long ms); +SYSTEMSHARED_EXPORT void timeSleepMs(unsigned long ms); #ifdef __cplusplus } diff --git a/src/system/system_global.h b/src/system/system_global.h index 0e02f0c..a719757 100644 --- a/src/system/system_global.h +++ b/src/system/system_global.h @@ -1,21 +1,31 @@ #ifndef SYSTEM_GLOBAL_H #define SYSTEM_GLOBAL_H +/* Shared object helpers */ #ifdef __cplusplus -#include - -#if defined(SYSTEM_LIBRARY) -# define SYSTEMSHARED_EXPORT Q_DECL_EXPORT +# include +# if defined(SYSTEM_LIBRARY) +# define SYSTEMSHARED_EXPORT Q_DECL_EXPORT +# else +# define SYSTEMSHARED_EXPORT Q_DECL_IMPORT +# endif #else -# define SYSTEMSHARED_EXPORT Q_DECL_IMPORT +# if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# define SYSTEMSHARED_EXPORT __declspec(dllimport) +# else +# define SYSTEMSHARED_EXPORT +# endif #endif +/* Namespace using */ +#ifdef __cplusplus namespace paysages { namespace system {} } - using namespace paysages::system; #endif +/* Global import */ + #endif // SYSTEM_GLOBAL_H