This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new b37967ab Use GCC recommended symbol visibility in the next ABI version
(#340)
b37967ab is described below
commit b37967ab089f2ee4949ec35ae6eb99d9b6753ad5
Author: Stephen Webb <[email protected]>
AuthorDate: Fri Feb 2 12:35:17 2024 +1100
Use GCC recommended symbol visibility in the next ABI version (#340)
---
src/main/cpp/CMakeLists.txt | 3 +++
src/main/include/log4cxx/log4cxx.h.in | 8 +++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt
index bc3f7cb3..ef4b8739 100644
--- a/src/main/cpp/CMakeLists.txt
+++ b/src/main/cpp/CMakeLists.txt
@@ -20,6 +20,9 @@ option(LOG4CXX_ABI_CHECK "Check for ABI changes" OFF)
# Build the log4cxx library
add_library(log4cxx)
+if(${log4cxx_ABI_VER} GREATER 15)
+ set_target_properties(log4cxx PROPERTIES CXX_VISIBILITY_PRESET hidden)
+endif()
if(BUILD_SHARED_LIBS)
target_compile_definitions(log4cxx PRIVATE LOG4CXX)
if(UNIX AND NOT APPLE)
diff --git a/src/main/include/log4cxx/log4cxx.h.in
b/src/main/include/log4cxx/log4cxx.h.in
index 53252f30..28978edd 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -95,9 +95,11 @@ __pragma( warning( pop ) )
#else // Linking against a DLL?
#define LOG4CXX_EXPORT __declspec(dllimport)
#endif // !LOG4CXX_STATIC
-#else // !defined(_WIN32) || !defined(_MSC_VER)
-#define LOG4CXX_EXPORT
-#endif // !defined(_WIN32) || !defined(_MSC_VER)
+#elif defined(__GNUC__) && 4 <= __GNUC__ && 15 < LOG4CXX_ABI_VERSION
+ #define LOG4CXX_EXPORT __attribute__ ((visibility ("default")))
+#else // !(defined(_WIN32) && defined(_MSC_VER)) || LOG4CXX_ABI_VERSION <= 15
|| __GNUC__ < 4
+ #define LOG4CXX_EXPORT
+#endif
#define LOG4CXX_NS @LOG4CXX_NS@