diff --git a/CMakeLists.txt b/CMakeLists.txt index 81df3bf8..b8517ea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -242,6 +242,10 @@ if (BUILD_SHARED_LIBS) endif () add_library(spdlog SHARED ${VERSION_RC}) target_compile_definitions(spdlog PUBLIC SPDLOG_SHARED_LIB) + set_target_properties(spdlog PROPERTIES + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN ON) + if (MSVC) # disable dlls related warnings on msvc target_compile_options(spdlog PUBLIC $<$,$>>:/wd4251 diff --git a/include/spdlog/details/null_mutex.h b/include/spdlog/details/null_mutex.h index 47b9845b..a0f50458 100644 --- a/include/spdlog/details/null_mutex.h +++ b/include/spdlog/details/null_mutex.h @@ -7,7 +7,6 @@ #include // null, no cost dummy "mutex" and dummy "atomic" log level - namespace spdlog { namespace details { struct null_mutex { diff --git a/include/spdlog/sinks/base_sink.h b/include/spdlog/sinks/base_sink.h index 04cc6883..5b60dcc9 100644 --- a/include/spdlog/sinks/base_sink.h +++ b/include/spdlog/sinks/base_sink.h @@ -36,7 +36,7 @@ public: protected: // sink formatter std::unique_ptr formatter_; - Mutex mutex_; + mutable Mutex mutex_; virtual void sink_it_(const details::log_msg &msg) = 0; virtual void flush_() = 0; diff --git a/src/sinks/ansicolor_sink.cpp b/src/sinks/ansicolor_sink.cpp index 74593fac..b684ea0f 100644 --- a/src/sinks/ansicolor_sink.cpp +++ b/src/sinks/ansicolor_sink.cpp @@ -117,6 +117,8 @@ ansicolor_stderr_sink::ansicolor_stderr_sink(color_mode mode) // template instantiations #include "spdlog/details/null_mutex.h" +template class SPDLOG_API spdlog::sinks::ansicolor_sink; +template class SPDLOG_API spdlog::sinks::ansicolor_sink; template class SPDLOG_API spdlog::sinks::ansicolor_stdout_sink; template class SPDLOG_API spdlog::sinks::ansicolor_stdout_sink; template class SPDLOG_API spdlog::sinks::ansicolor_stderr_sink; diff --git a/src/sinks/rotating_file_sink.cpp b/src/sinks/rotating_file_sink.cpp index b58115bd..b43c4628 100644 --- a/src/sinks/rotating_file_sink.cpp +++ b/src/sinks/rotating_file_sink.cpp @@ -142,4 +142,4 @@ bool rotating_file_sink::rename_file_(const filename_t &src_filename, con // template instantiations #include "spdlog/details/null_mutex.h" template class SPDLOG_API spdlog::sinks::rotating_file_sink; -template class SPDLOG_API spdlog::sinks::rotating_file_sink; \ No newline at end of file +template class SPDLOG_API spdlog::sinks::rotating_file_sink;