From 92cf234b0c2eb41fbbac38b173723a4a58d3621b Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 14 Mar 2017 00:33:26 +0300 Subject: [PATCH] log/win32: fix exporting extern variable ==> win: C:\vagrant\log.c(73): error C2370: 'event_debug_logging_mask_' : redefinition; different storage class [C:\vagrant\.cmake-vagrant\event_core_shared.vcxproj] --- include/event2/visibility.h | 12 +++++++++++- log-internal.h | 4 ++-- log.c | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/event2/visibility.h b/include/event2/visibility.h index 57ea3b76..af30905d 100644 --- a/include/event2/visibility.h +++ b/include/event2/visibility.h @@ -34,6 +34,7 @@ defined(event_core_shared_EXPORTS) || \ defined(event_pthreads_shared_EXPORTS) || \ defined(event_openssl_shared_EXPORTS) + # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define EVENT2_EXPORT_SYMBOL __global # elif defined __GNUC__ @@ -43,12 +44,21 @@ # else # define EVENT2_EXPORT_SYMBOL /* unknown compiler */ # endif -#else + +#else /* event_*_EXPORTS */ + # if defined(_MSC_VER) # define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport) # else # define EVENT2_EXPORT_SYMBOL # endif + +#endif /* event_*_EXPORTS */ + +#if defined(_MSC_VER) +# define EVENT2_EXPORT_SYMBOL_DECL __declspec(dllimport) +#else +# define EVENT2_EXPORT_SYMBOL_DECL extern #endif #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */ diff --git a/log-internal.h b/log-internal.h index 4c927afc..b9d19f13 100644 --- a/log-internal.h +++ b/log-internal.h @@ -48,8 +48,8 @@ extern "C" { #endif #ifdef EVENT_DEBUG_LOGGING_ENABLED -EVENT2_EXPORT_SYMBOL -extern ev_uint32_t event_debug_logging_mask_; +EVENT2_EXPORT_SYMBOL_DECL +ev_uint32_t event_debug_logging_mask_; #define event_debug_get_logging_mask_() (event_debug_logging_mask_) #else #define event_debug_get_logging_mask_() (0) diff --git a/log.c b/log.c index 0bbee620..ed955575 100644 --- a/log.c +++ b/log.c @@ -69,6 +69,7 @@ static event_fatal_cb fatal_fn = NULL; #define DEFAULT_MASK 0 #endif +EVENT2_EXPORT_SYMBOL ev_uint32_t event_debug_logging_mask_ = DEFAULT_MASK; #endif /* EVENT_DEBUG_LOGGING_ENABLED */