From fc65f913c1ef988ab808131fcf94571ef0684891 Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Sat, 13 Jan 2024 17:10:38 +0100 Subject: [PATCH] fix(JSON): explicitly instantiate and export SharedPtr for JSON::Array and JSON::Object (-fvisibility=hidden) (#4393, #3331) --- JSON/include/Poco/JSON/Array.h | 9 +++++++++ JSON/include/Poco/JSON/Object.h | 9 +++++++++ JSON/src/Array.cpp | 4 ++++ JSON/src/Object.cpp | 5 +++++ 4 files changed, 27 insertions(+) diff --git a/JSON/include/Poco/JSON/Array.h b/JSON/include/Poco/JSON/Array.h index 631160de61..68c8d55e13 100644 --- a/JSON/include/Poco/JSON/Array.h +++ b/JSON/include/Poco/JSON/Array.h @@ -26,8 +26,17 @@ namespace Poco { + namespace JSON { +class JSON_API Array; + +} + +// Explicitly instantiated shared pointer in JSON library +extern template class JSON_API Poco::SharedPtr; + +namespace JSON { class Object; diff --git a/JSON/include/Poco/JSON/Object.h b/JSON/include/Poco/JSON/Object.h index e7eae62495..502ce6f236 100644 --- a/JSON/include/Poco/JSON/Object.h +++ b/JSON/include/Poco/JSON/Object.h @@ -34,8 +34,17 @@ namespace Poco { + namespace JSON { +class JSON_API Object; + +} + +// Explicitly instatiated shared pointer in JSON library +extern template class JSON_API Poco::SharedPtr; + +namespace JSON { class JSON_API Object /// Represents a JSON object. Object provides a representation based on diff --git a/JSON/src/Array.cpp b/JSON/src/Array.cpp index 05f40503f6..5179c84222 100644 --- a/JSON/src/Array.cpp +++ b/JSON/src/Array.cpp @@ -20,6 +20,10 @@ using Poco::Dynamic::Var; +// Explicitly instatiated shared pointer in JSON library is required to +// have known instance of the pointer to be used with VarHolder when +// compiling with -fvisibility=hidden +template class Poco::SharedPtr; namespace Poco { namespace JSON { diff --git a/JSON/src/Object.cpp b/JSON/src/Object.cpp index 36c23e61f1..036f602ce8 100644 --- a/JSON/src/Object.cpp +++ b/JSON/src/Object.cpp @@ -19,8 +19,13 @@ using Poco::Dynamic::Var; +// Explicitly instatiated shared pointer in JSON library is required to +// have known instance of the pointer to be used with VarHolder when +// compiling with -fvisibility=hidden +template class Poco::SharedPtr; namespace Poco { + namespace JSON {