Win32 DLL support for libpaysages_system

This commit is contained in:
Michaël Lemaire 2013-10-20 15:24:58 +02:00
parent ad1a492884
commit 6ab664485a
3 changed files with 25 additions and 15 deletions

View file

@ -15,7 +15,7 @@ namespace system
/*! /*!
* \brief System mutex * \brief System mutex
*/ */
class Mutex: private QMutex class SYSTEMSHARED_EXPORT Mutex: private QMutex
{ {
public: public:
/*! /*!
@ -39,10 +39,10 @@ extern "C" {
typedef struct Mutex Mutex; typedef struct Mutex Mutex;
#endif #endif
Mutex* mutexCreate(); SYSTEMSHARED_EXPORT Mutex* mutexCreate();
void mutexDestroy(Mutex* mutex); SYSTEMSHARED_EXPORT void mutexDestroy(Mutex* mutex);
void mutexAcquire(Mutex* mutex); SYSTEMSHARED_EXPORT void mutexAcquire(Mutex* mutex);
void mutexRelease(Mutex* mutex); SYSTEMSHARED_EXPORT void mutexRelease(Mutex* mutex);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -17,7 +17,7 @@ namespace system
/*! /*!
* \brief System thread * \brief System thread
*/ */
class Thread: private QThread class SYSTEMSHARED_EXPORT Thread: private QThread
{ {
public: public:
/*! /*!
@ -61,10 +61,10 @@ extern "C" {
typedef struct Thread Thread; typedef struct Thread Thread;
#endif #endif
Thread* threadCreate(ThreadFunction function, void* data); SYSTEMSHARED_EXPORT Thread* threadCreate(ThreadFunction function, void* data);
void* threadJoin(Thread* thread); SYSTEMSHARED_EXPORT void* threadJoin(Thread* thread);
void timeSleepMs(unsigned long ms); SYSTEMSHARED_EXPORT void timeSleepMs(unsigned long ms);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -1,21 +1,31 @@
#ifndef SYSTEM_GLOBAL_H #ifndef SYSTEM_GLOBAL_H
#define SYSTEM_GLOBAL_H #define SYSTEM_GLOBAL_H
/* Shared object helpers */
#ifdef __cplusplus #ifdef __cplusplus
# include <QtCore/qglobal.h> # include <QtCore/qglobal.h>
# if defined(SYSTEM_LIBRARY) # if defined(SYSTEM_LIBRARY)
# define SYSTEMSHARED_EXPORT Q_DECL_EXPORT # define SYSTEMSHARED_EXPORT Q_DECL_EXPORT
# else # else
# define SYSTEMSHARED_EXPORT Q_DECL_IMPORT # define SYSTEMSHARED_EXPORT Q_DECL_IMPORT
# endif # endif
#else
# 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 paysages
{ {
namespace system {} namespace system {}
} }
using namespace paysages::system; using namespace paysages::system;
#endif #endif
/* Global import */
#endif // SYSTEM_GLOBAL_H #endif // SYSTEM_GLOBAL_H