From 58e2b455fb99e00d263f1ceb0c18a5ac6a0d1578 Mon Sep 17 00:00:00 2001 From: LE GARREC Vincent Date: Thu, 25 Nov 2021 00:16:28 +0100 Subject: [PATCH] Fix build with "-fvisibility=hidden" --- include/spdlog/common.h | 16 ++++++++++------ include/spdlog/sinks/base_sink.h | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index c7f7e46d..9239ab1a 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -22,13 +22,17 @@ #ifdef SPDLOG_COMPILED_LIB # undef SPDLOG_HEADER_ONLY -# if defined(_WIN32) && defined(SPDLOG_SHARED_LIB) -# ifdef spdlog_EXPORTS -# define SPDLOG_API __declspec(dllexport) -# else -# define SPDLOG_API __declspec(dllimport) +# if defined(SPDLOG_SHARED_LIB) +# if defined(_WIN32) +# ifdef spdlog_EXPORTS +# define SPDLOG_API __declspec(dllexport) +# else // !spdlog_EXPORTS +# define SPDLOG_API __declspec(dllimport) +# endif +# else // !defined(_WIN32) +# define SPDLOG_API __attribute__((visibility ("default"))) # endif -# else // !defined(_WIN32) || !defined(SPDLOG_SHARED_LIB) +# else // !defined(SPDLOG_SHARED_LIB) # define SPDLOG_API # endif # define SPDLOG_INLINE diff --git a/include/spdlog/sinks/base_sink.h b/include/spdlog/sinks/base_sink.h index 21c5545f..2e795f59 100644 --- a/include/spdlog/sinks/base_sink.h +++ b/include/spdlog/sinks/base_sink.h @@ -16,7 +16,7 @@ namespace spdlog { namespace sinks { template -class base_sink : public sink +class SPDLOG_API base_sink : public sink { public: base_sink();