diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2012-09-06 10:25:57 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2012-09-06 10:25:57 +0200 |
commit | f5c586f7231f7e033c5528bcefea357e4e64441c (patch) | |
tree | 4d039e54c77bdb84a1cb79b56db7b62bccdd43d8 /include/util | |
parent | a29c464aa72d46cc956ac2752a2518526c499716 (diff) | |
download | crawler-f5c586f7231f7e033c5528bcefea357e4e64441c.tar.gz crawler-f5c586f7231f7e033c5528bcefea357e4e64441c.tar.bz2 |
first properly working logger on Windows (singleton dll issue)
Diffstat (limited to 'include/util')
-rwxr-xr-x | include/util/Exportable.hpp | 23 | ||||
-rwxr-xr-x | include/util/NonCopyable.hpp | 2 | ||||
-rwxr-xr-x | include/util/ScopedPtr.hpp | 2 | ||||
-rwxr-xr-x | include/util/Singleton.hpp | 14 |
4 files changed, 24 insertions, 17 deletions
diff --git a/include/util/Exportable.hpp b/include/util/Exportable.hpp index a676ae3..fc8269f 100755 --- a/include/util/Exportable.hpp +++ b/include/util/Exportable.hpp @@ -3,21 +3,22 @@ #ifndef _WIN32 -#define SINGLETON_EXPORT -#define SINGLETON_EXTERN - -#define DLL_EXPORT +#define DLL_VISIBLE +#define DLL_EXTERN #else -#define DLL_EXPORT __declspec(dllexport) - -#ifndef SHARED -#define SINGLETON_EXPORT __declspec(dllexport) -#define SINGLETON_EXTERN +#ifdef NODLL +#define DLL_VISIBLE +#define DLL_EXTERN #else -#define SINGLETON_EXPORT __declspec(dllimport) -#define SINGLETON_EXTERN extern +#ifdef SHARED +#define DLL_VISIBLE __declspec(dllexport) +#define DLL_EXTERN +#else +#define DLL_VISIBLE __declspec(dllimport) +#define DLL_EXTERN +#endif #endif #endif // _WIN32 diff --git a/include/util/NonCopyable.hpp b/include/util/NonCopyable.hpp index 44d1a93..99804d2 100755 --- a/include/util/NonCopyable.hpp +++ b/include/util/NonCopyable.hpp @@ -6,7 +6,7 @@ namespace __dont_touch { -class SINGLETON_EXPORT noncopyable +class DLL_VISIBLE noncopyable { protected: noncopyable( ) { } diff --git a/include/util/ScopedPtr.hpp b/include/util/ScopedPtr.hpp index 19a41d2..991409d 100755 --- a/include/util/ScopedPtr.hpp +++ b/include/util/ScopedPtr.hpp @@ -4,7 +4,7 @@ #include "NonCopyable.hpp" template< typename T > -class scopedPtr : private noncopyable +class DLL_VISIBLE scopedPtr : private noncopyable { public: explicit scopedPtr( T *p = 0 ) : m_p( p ) { } diff --git a/include/util/Singleton.hpp b/include/util/Singleton.hpp index 1bfb460..f291435 100755 --- a/include/util/Singleton.hpp +++ b/include/util/Singleton.hpp @@ -10,17 +10,23 @@ #include <stdexcept> #define DECLARE_SINGLETON( T ) \ - friend class scopedPtr< T >; \ - friend class Singleton< T >; + friend class Singleton< T >; \ + friend class scopedPtr< T >; + +#define DEFINE_SINGLETON( T ) + +#if 0 +#define DECLARE_SINGLETON( T ) \ #define DEFINE_SINGLETON( T ) \ - SINGLETON_EXTERN template class SINGLETON_EXPORT Singleton< T >; + DLL_EXTERN template class DLL_VISIBLE Singleton< T >; +#endif template< class T > class Singleton : private noncopyable { public: - static T& instance( ) + DLL_VISIBLE static T& instance( ) { if( destroyed ) { onDeadReference( ); |