From ff96b4d789b5f2d5265ca8498f503081820fef8d Mon Sep 17 00:00:00 2001 From: wang zhichao Date: Wed, 15 Jul 2026 22:42:20 +0800 Subject: [PATCH] Preserve hidden symbol visibility for static builds with GCC-compatible compilers --- tinyxml2.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tinyxml2.h b/tinyxml2.h index 048f8543..b4ab1848 100644 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -59,7 +59,13 @@ distribution. # define TINYXML2_LIB # endif #elif __GNUC__ >= 4 -# define TINYXML2_LIB __attribute__((visibility("default"))) +# ifdef TINYXML2_EXPORT +# define TINYXML2_LIB __attribute__((visibility("default"))) +# elif defined(TINYXML2_IMPORT) +# define TINYXML2_LIB __attribute__((visibility("default"))) +# else +# define TINYXML2_LIB +# endif #else # define TINYXML2_LIB #endif