From 4110b30c48a94edd89ac8d79405a3bc8033f8558 Mon Sep 17 00:00:00 2001 From: Geroge Albany Date: Tue, 16 Aug 2016 17:30:44 -0400 Subject: [PATCH 1/2] Support GNUC exporting Allows GNUC and GCC exporting commonly found on non-windows platforms. --- src/ITMA.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ITMA.hpp b/src/ITMA.hpp index 0184ebb..8ba624a 100644 --- a/src/ITMA.hpp +++ b/src/ITMA.hpp @@ -17,9 +17,17 @@ //Windows dll EXPORT definition //TODO: add Cross-platform dynamic library macros #ifdef ITMA_EXPORT -#define EXPORT __declspec(dllexport) +# if defined(_WIN32) +# define EXPORT __declspec(dllexport) +# elif defined(__GNUC__) +# define EXPORT __attribute__((visibility("default"))) +# else +# define EXPORT +# endif +#elif defined(_WIN32) +# define EXPORT __declspec(dllimport) #else -#define EXPORT __declspec(dllimport) +# define EXPORT #endif //MTMA_EXPORT /* TODO: Make EXPORT macro compatible with Unix compilers for dynamic link library creation. */ @@ -244,4 +252,4 @@ namespace ITMA }//namespace MTMA -#endif //ITMA_HPP \ No newline at end of file +#endif //ITMA_HPP From 724d303fbf78a0615254fdbc1868c1228c1a0f9d Mon Sep 17 00:00:00 2001 From: Geroge Albany Date: Tue, 16 Aug 2016 17:33:44 -0400 Subject: [PATCH 2/2] Just Export is a very bad name, don't do that for macros please!! --- src/ITMA.hpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/ITMA.hpp b/src/ITMA.hpp index 8ba624a..b64efdb 100644 --- a/src/ITMA.hpp +++ b/src/ITMA.hpp @@ -14,24 +14,21 @@ #include #include -//Windows dll EXPORT definition -//TODO: add Cross-platform dynamic library macros +//_ITMA_EXPORT definition #ifdef ITMA_EXPORT # if defined(_WIN32) -# define EXPORT __declspec(dllexport) +# define _ITMA_EXPORT __declspec(dllexport) # elif defined(__GNUC__) -# define EXPORT __attribute__((visibility("default"))) +# define _ITMA_EXPORT __attribute__((visibility("default"))) # else -# define EXPORT +# define _ITMA_EXPORT # endif #elif defined(_WIN32) -# define EXPORT __declspec(dllimport) +# define _ITMA_EXPORT __declspec(dllimport) #else -# define EXPORT +# define _ITMA_EXPORT #endif //MTMA_EXPORT -/* TODO: Make EXPORT macro compatible with Unix compilers for dynamic link library creation. */ - #include "custom_vector.h" #include "custom_queue.h" @@ -39,7 +36,7 @@ namespace ITMA { class pipe; - class EXPORT MContext + class _ITMA_EXPORT MContext { std::thread context; CustomVector> pipes; @@ -54,7 +51,7 @@ namespace ITMA }; //ZMQPP socket style setup - class EXPORT Channel + class _ITMA_EXPORT Channel { std::shared_ptr pip; MContext & _ctx; @@ -152,7 +149,7 @@ namespace ITMA } }; - class EXPORT pipe + class _ITMA_EXPORT pipe { CustomQueue in; //incoming messages CustomQueue out; //outgoing messages