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..1dfff657 100644 --- a/include/spdlog/details/null_mutex.h +++ b/include/spdlog/details/null_mutex.h @@ -5,18 +5,18 @@ #include #include - +#include "../common.h" // null, no cost dummy "mutex" and dummy "atomic" log level namespace spdlog { namespace details { -struct null_mutex { +struct SPDLOG_API null_mutex { void lock() const {} void unlock() const {} }; template -struct null_atomic { +struct SPDLOG_API null_atomic { T value; null_atomic() = default; 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;