geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From igod...@apache.org
Subject [geode-native] 01/02: GEODE-5025: Fixes template visiblity when linked with executables. (#387)
Date Thu, 08 Nov 2018 17:43:45 GMT
This is an automated email from the ASF dual-hosted git repository.

igodwin pushed a commit to branch release/1.8
in repository https://gitbox.apache.org/repos/asf/geode-native.git

commit 8d061085039a61b11495f9dfa4d51d20e620825b
Author: Jacob Barrett <jbarrett@pivotal.io>
AuthorDate: Fri Nov 2 12:25:26 2018 -0700

    GEODE-5025: Fixes template visiblity when linked with executables. (#387)
---
 cppcache/include/geode/CacheableBuiltins.hpp       | 185 ++++++++++++---------
 cppcache/include/geode/CacheableKey.hpp            |   2 +-
 cppcache/include/geode/RegionAttributes.hpp        |  11 +-
 .../geode/internal/CacheableBuiltinTemplates.hpp   |  25 ++-
 .../geode/internal/DataSerializablePrimitive.hpp   |   2 +-
 cppcache/integration-test-2/CMakeLists.txt         |   5 +-
 cppcache/integration-test/CMakeLists.txt           |   6 +-
 .../integration-test/testOverflowPutGetSqLite.cpp  |   1 +
 cppcache/shared/CMakeLists.txt                     |  20 ++-
 cppcache/src/CacheableBuiltins.cpp                 |  46 ++++-
 cppcache/src/PdxInstanceImpl.cpp                   |   3 +-
 cppcache/src/RegionAttributes.cpp                  |   1 +
 cppcache/src/TcrMessage.cpp                        |   2 +-
 13 files changed, 188 insertions(+), 121 deletions(-)

diff --git a/cppcache/include/geode/CacheableBuiltins.hpp b/cppcache/include/geode/CacheableBuiltins.hpp
index 494b610..ec81932 100644
--- a/cppcache/include/geode/CacheableBuiltins.hpp
+++ b/cppcache/include/geode/CacheableBuiltins.hpp
@@ -38,34 +38,14 @@ namespace apache {
 namespace geode {
 namespace client {
 
-using internal::CacheableArrayPrimitive;
-using internal::CacheableContainerPrimitive;
-using internal::CacheableKeyPrimitive;
-
-/** Function to copy an array from source to destination. */
-template <typename TObj>
-inline void copyArray(TObj* dest, const TObj* src, size_t length) {
-  std::memcpy(dest, src, length * sizeof(TObj));
-}
-
-/**
- * Function to copy an array of <code>std::shared_ptr</code>s from
- * source to destination.
- */
-template <typename TObj>
-inline void copyArray(std::shared_ptr<TObj>* dest,
-                      const std::shared_ptr<TObj>* src, size_t length) {
-  for (size_t index = 0; index < length; index++) {
-    dest[index] = src[index];
-  }
-}
-
 /**
  * An immutable wrapper for bool that can serve as
  * a distributable key object for caching.
  */
 using CacheableBoolean =
-    CacheableKeyPrimitive<bool, internal::DSCode::CacheableBoolean>;
+    internal::CacheableKeyPrimitive<bool, internal::DSCode::CacheableBoolean>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<bool, internal::DSCode::CacheableBoolean>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(bool value) {
   return CacheableBoolean::create(value);
@@ -80,7 +60,9 @@ inline std::shared_ptr<Cacheable> Serializable::create(bool value)
{
  * a distributable key object for caching.
  */
 using CacheableByte =
-    CacheableKeyPrimitive<int8_t, internal::DSCode::CacheableByte>;
+    internal::CacheableKeyPrimitive<int8_t, internal::DSCode::CacheableByte>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<int8_t, internal::DSCode::CacheableByte>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(int8_t value) {
   return CacheableByte::create(value);
@@ -95,7 +77,9 @@ inline std::shared_ptr<Cacheable> Serializable::create(int8_t value)
{
  * a distributable key object for caching.
  */
 using CacheableDouble =
-    CacheableKeyPrimitive<double, internal::DSCode::CacheableDouble>;
+    internal::CacheableKeyPrimitive<double, internal::DSCode::CacheableDouble>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<double, internal::DSCode::CacheableDouble>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(double value) {
   return CacheableDouble::create(value);
@@ -111,7 +95,9 @@ inline std::shared_ptr<Cacheable> Serializable::create(double value)
{
  * a distributable key object for caching.
  */
 using CacheableFloat =
-    CacheableKeyPrimitive<float, internal::DSCode::CacheableFloat>;
+    internal::CacheableKeyPrimitive<float, internal::DSCode::CacheableFloat>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<float, internal::DSCode::CacheableFloat>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(float value) {
   return CacheableFloat::create(value);
@@ -126,7 +112,9 @@ inline std::shared_ptr<Cacheable> Serializable::create(float value)
{
  * a distributable key object for caching.
  */
 using CacheableInt16 =
-    CacheableKeyPrimitive<int16_t, internal::DSCode::CacheableInt16>;
+    internal::CacheableKeyPrimitive<int16_t, internal::DSCode::CacheableInt16>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<int16_t, internal::DSCode::CacheableInt16>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(int16_t value) {
   return CacheableInt16::create(value);
@@ -141,7 +129,9 @@ inline std::shared_ptr<Cacheable> Serializable::create(int16_t value)
{
  * a distributable key object for caching.
  */
 using CacheableInt32 =
-    CacheableKeyPrimitive<int32_t, internal::DSCode::CacheableInt32>;
+    internal::CacheableKeyPrimitive<int32_t, internal::DSCode::CacheableInt32>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<int32_t, internal::DSCode::CacheableInt32>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(int32_t value) {
   return CacheableInt32::create(value);
@@ -156,7 +146,9 @@ inline std::shared_ptr<Cacheable> Serializable::create(int32_t value)
{
  * a distributable key object for caching.
  */
 using CacheableInt64 =
-    CacheableKeyPrimitive<int64_t, internal::DSCode::CacheableInt64>;
+    internal::CacheableKeyPrimitive<int64_t, internal::DSCode::CacheableInt64>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<int64_t, internal::DSCode::CacheableInt64>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(int64_t value) {
   return CacheableInt64::create(value);
@@ -171,7 +163,11 @@ inline std::shared_ptr<Cacheable> Serializable::create(int64_t
value) {
  * a distributable key object for caching.
  */
 using CacheableCharacter =
-    CacheableKeyPrimitive<char16_t, internal::DSCode::CacheableCharacter>;
+    internal::CacheableKeyPrimitive<char16_t,
+                                    internal::DSCode::CacheableCharacter>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableKeyPrimitive<char16_t,
+                                    internal::DSCode::CacheableCharacter>;
 template <>
 inline std::shared_ptr<CacheableKey> CacheableKey::create(char16_t value) {
   return CacheableCharacter::create(value);
@@ -185,62 +181,94 @@ inline std::shared_ptr<Cacheable> Serializable::create(char16_t
value) {
  * An immutable wrapper for byte arrays that can serve as
  * a distributable object for caching.
  */
-using CacheableBytes = CacheableArrayPrimitive<int8_t, DSCode::CacheableBytes>;
+using CacheableBytes =
+    internal::CacheableArrayPrimitive<int8_t, internal::DSCode::CacheableBytes>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<int8_t, internal::DSCode::CacheableBytes>;
 
 /**
  * An immutable wrapper for array of booleans that can serve as
  * a distributable object for caching.
  */
-using BooleanArray = CacheableArrayPrimitive<bool, DSCode::BooleanArray>;
+using BooleanArray =
+    internal::CacheableArrayPrimitive<bool, internal::DSCode::BooleanArray>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<bool, internal::DSCode::BooleanArray>;
 
 /**
  * An immutable wrapper for array of wide-characters that can serve as
  * a distributable object for caching.
  */
-using CharArray = CacheableArrayPrimitive<char16_t, DSCode::CharArray>;
+using CharArray =
+    internal::CacheableArrayPrimitive<char16_t, internal::DSCode::CharArray>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<char16_t, internal::DSCode::CharArray>;
 
 /**
  * An immutable wrapper for array of doubles that can serve as
  * a distributable object for caching.
  */
 using CacheableDoubleArray =
-    CacheableArrayPrimitive<double, DSCode::CacheableDoubleArray>;
+    internal::CacheableArrayPrimitive<double,
+                                      internal::DSCode::CacheableDoubleArray>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<double,
+                                      internal::DSCode::CacheableDoubleArray>;
 
 /**
  * An immutable wrapper for array of floats that can serve as
  * a distributable object for caching.
  */
 using CacheableFloatArray =
-    CacheableArrayPrimitive<float, DSCode::CacheableFloatArray>;
+    internal::CacheableArrayPrimitive<float,
+                                      internal::DSCode::CacheableFloatArray>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<float,
+                                      internal::DSCode::CacheableFloatArray>;
 
 /**
  * An immutable wrapper for array of 16-bit integers that can serve as
  * a distributable object for caching.
  */
 using CacheableInt16Array =
-    CacheableArrayPrimitive<int16_t, DSCode::CacheableInt16Array>;
+    internal::CacheableArrayPrimitive<int16_t,
+                                      internal::DSCode::CacheableInt16Array>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<int16_t,
+                                      internal::DSCode::CacheableInt16Array>;
 
 /**
  * An immutable wrapper for array of 32-bit integers that can serve as
  * a distributable object for caching.
  */
 using CacheableInt32Array =
-    CacheableArrayPrimitive<int32_t, DSCode::CacheableInt32Array>;
+    internal::CacheableArrayPrimitive<int32_t,
+                                      internal::DSCode::CacheableInt32Array>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<int32_t,
+                                      internal::DSCode::CacheableInt32Array>;
 
 /**
  * An immutable wrapper for array of 64-bit integers that can serve as
  * a distributable object for caching.
  */
 using CacheableInt64Array =
-    CacheableArrayPrimitive<int64_t, DSCode::CacheableInt64Array>;
+    internal::CacheableArrayPrimitive<int64_t,
+                                      internal::DSCode::CacheableInt64Array>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<int64_t,
+                                      internal::DSCode::CacheableInt64Array>;
 
 /**
  * An immutable wrapper for array of strings that can serve as
  * a distributable object for caching.
  */
 using CacheableStringArray =
-    CacheableArrayPrimitive<std::shared_ptr<CacheableString>,
-                            DSCode::CacheableStringArray>;
+    internal::CacheableArrayPrimitive<std::shared_ptr<CacheableString>,
+                                      internal::DSCode::CacheableStringArray>;
+extern template class APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+    internal::CacheableArrayPrimitive<std::shared_ptr<CacheableString>,
+                                      internal::DSCode::CacheableStringArray>;
 
 // The following are defined as classes to avoid the issues with MSVC++
 // warning/erroring on C4503
@@ -250,15 +278,15 @@ using CacheableStringArray =
  * a distributable object for caching.
  */
 class APACHE_GEODE_EXPORT CacheableVector
-    : public CacheableContainerPrimitive<
-          std::vector<std::shared_ptr<Cacheable>>, DSCode::CacheableVector,
-          CacheableVector> {
+    : public internal::CacheableContainerPrimitive<
+          std::vector<std::shared_ptr<Cacheable>>,
+          internal::DSCode::CacheableVector, CacheableVector> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    std::vector<std::shared_ptr<Cacheable>>, DSCode::CacheableVector,
+    std::vector<std::shared_ptr<Cacheable>>, internal::DSCode::CacheableVector,
     CacheableVector>;
 
 /**
@@ -266,91 +294,94 @@ template class internal::CacheableContainerPrimitive<
  * hash map that can serve as a distributable object for caching.
  */
 class APACHE_GEODE_EXPORT CacheableHashMap
-    : public CacheableContainerPrimitive<
-          HashMapOfCacheable, DSCode::CacheableHashMap, CacheableHashMap> {
+    : public internal::CacheableContainerPrimitive<
+          HashMapOfCacheable, internal::DSCode::CacheableHashMap,
+          CacheableHashMap> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    HashMapOfCacheable, DSCode::CacheableHashMap, CacheableHashMap>;
+    HashMapOfCacheable, internal::DSCode::CacheableHashMap, CacheableHashMap>;
 
 /**
  * A mutable <code>CacheableKey</code> hash set wrapper that can serve as
  * a distributable object for caching.
  */
-// using CacheableHashSet = CacheableContainerPrimitive<HashSetOfCacheableKey,
-//                                                     DSCode::CacheableHashSet>;
 class APACHE_GEODE_EXPORT CacheableHashSet
-    : public CacheableContainerPrimitive<
-          HashSetOfCacheableKey, DSCode::CacheableHashSet, CacheableHashSet> {
+    : public internal::CacheableContainerPrimitive<
+          HashSetOfCacheableKey, internal::DSCode::CacheableHashSet,
+          CacheableHashSet> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    HashSetOfCacheableKey, DSCode::CacheableHashSet, CacheableHashSet>;
+    HashSetOfCacheableKey, internal::DSCode::CacheableHashSet,
+    CacheableHashSet>;
 
 /**
  * A mutable <code>Cacheable</code> array list wrapper that can serve as
  * a distributable object for caching.
  */
 class APACHE_GEODE_EXPORT CacheableArrayList
-    : public CacheableContainerPrimitive<
-          std::vector<std::shared_ptr<Cacheable>>, DSCode::CacheableArrayList,
-          CacheableArrayList> {
+    : public internal::CacheableContainerPrimitive<
+          std::vector<std::shared_ptr<Cacheable>>,
+          internal::DSCode::CacheableArrayList, CacheableArrayList> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    std::vector<std::shared_ptr<Cacheable>>, DSCode::CacheableArrayList,
-    CacheableArrayList>;
+    std::vector<std::shared_ptr<Cacheable>>,
+    internal::DSCode::CacheableArrayList, CacheableArrayList>;
 
 /**
  * A mutable <code>Cacheable</code> array list wrapper that can serve as
  * a distributable object for caching.
  */
 class APACHE_GEODE_EXPORT CacheableLinkedList
-    : public CacheableContainerPrimitive<
-          std::vector<std::shared_ptr<Cacheable>>, DSCode::CacheableLinkedList,
-          CacheableLinkedList> {
+    : public internal::CacheableContainerPrimitive<
+          std::vector<std::shared_ptr<Cacheable>>,
+          internal::DSCode::CacheableLinkedList, CacheableLinkedList> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    std::vector<std::shared_ptr<Cacheable>>, DSCode::CacheableLinkedList,
-    CacheableLinkedList>;
+    std::vector<std::shared_ptr<Cacheable>>,
+    internal::DSCode::CacheableLinkedList, CacheableLinkedList>;
 
 /**
  * A mutable <code>Cacheable</code> stack wrapper that can serve as
  * a distributable object for caching.
  */
 class APACHE_GEODE_EXPORT CacheableStack
-    : public CacheableContainerPrimitive<
-          std::vector<std::shared_ptr<Cacheable>>, DSCode::CacheableStack,
-          CacheableStack> {
+    : public internal::CacheableContainerPrimitive<
+          std::vector<std::shared_ptr<Cacheable>>,
+          internal::DSCode::CacheableStack, CacheableStack> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    HashMapOfCacheable, DSCode::CacheableStack, CacheableStack>;
+    HashMapOfCacheable, internal::DSCode::CacheableStack, CacheableStack>;
 
 /**
  * A mutable <code>CacheableKey</code> to <code>Serializable</code>
  * hash map that can serve as a distributable object for caching.
  */
 class APACHE_GEODE_EXPORT CacheableHashTable
-    : public CacheableContainerPrimitive<
-          HashMapOfCacheable, DSCode::CacheableHashTable, CacheableHashTable> {
+    : public internal::CacheableContainerPrimitive<
+          HashMapOfCacheable, internal::DSCode::CacheableHashTable,
+          CacheableHashTable> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    HashMapOfCacheable, DSCode::CacheableHashTable, CacheableHashTable>;
+    HashMapOfCacheable, internal::DSCode::CacheableHashTable,
+    CacheableHashTable>;
 
 /**
  * A mutable <code>CacheableKey</code> to <code>Serializable</code>
@@ -360,15 +391,15 @@ template class internal::CacheableContainerPrimitive<
  * java <code>IdentityHashMap</code>.
  */
 class APACHE_GEODE_EXPORT CacheableIdentityHashMap
-    : public CacheableContainerPrimitive<HashMapOfCacheable,
-                                         DSCode::CacheableIdentityHashMap,
-                                         CacheableIdentityHashMap> {
+    : public internal::CacheableContainerPrimitive<
+          HashMapOfCacheable, internal::DSCode::CacheableIdentityHashMap,
+          CacheableIdentityHashMap> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    HashMapOfCacheable, DSCode::CacheableIdentityHashMap,
+    HashMapOfCacheable, internal::DSCode::CacheableIdentityHashMap,
     CacheableIdentityHashMap>;
 
 /**
@@ -379,15 +410,15 @@ template class internal::CacheableContainerPrimitive<
  * iteration semantics of java <code>LinkedHashSet</code>.
  */
 class APACHE_GEODE_EXPORT CacheableLinkedHashSet
-    : public CacheableContainerPrimitive<HashSetOfCacheableKey,
-                                         DSCode::CacheableLinkedHashSet,
-                                         CacheableLinkedHashSet> {
+    : public internal::CacheableContainerPrimitive<
+          HashSetOfCacheableKey, internal::DSCode::CacheableLinkedHashSet,
+          CacheableLinkedHashSet> {
  public:
   using CacheableContainerPrimitive::CacheableContainerPrimitive;
 };
 
 template class internal::CacheableContainerPrimitive<
-    HashSetOfCacheableKey, DSCode::CacheableLinkedHashSet,
+    HashSetOfCacheableKey, internal::DSCode::CacheableLinkedHashSet,
     CacheableLinkedHashSet>;
 
 }  // namespace client
diff --git a/cppcache/include/geode/CacheableKey.hpp b/cppcache/include/geode/CacheableKey.hpp
index 4efcddc..5b084fc 100644
--- a/cppcache/include/geode/CacheableKey.hpp
+++ b/cppcache/include/geode/CacheableKey.hpp
@@ -40,7 +40,7 @@ namespace client {
 class APACHE_GEODE_EXPORT CacheableKey : public virtual Cacheable {
  protected:
   CacheableKey() = default;
-  ~CacheableKey() override = default;
+  ~CacheableKey() noexcept override = default;
 
  public:
   /** return true if this key matches other. */
diff --git a/cppcache/include/geode/RegionAttributes.hpp b/cppcache/include/geode/RegionAttributes.hpp
index 3652955..702218b 100644
--- a/cppcache/include/geode/RegionAttributes.hpp
+++ b/cppcache/include/geode/RegionAttributes.hpp
@@ -32,7 +32,6 @@
 #include "DiskPolicyType.hpp"
 #include "ExpirationAttributes.hpp"
 #include "PartitionResolver.hpp"
-#include "PersistenceManager.hpp"
 #include "Properties.hpp"
 #include "Serializable.hpp"
 #include "internal/DataSerializableInternal.hpp"
@@ -44,6 +43,11 @@ namespace geode {
 namespace client {
 
 class CacheImpl;
+class RegionAttributesFactory;
+class AttributesMutator;
+class Cache;
+class Region;
+class PersistenceManager;
 
 /**
  * @class RegionAttributes RegionAttributes.hpp
@@ -69,11 +73,6 @@ class CacheImpl;
  * @see AttributesMutator
  * @see Region::getAttributes
  */
-class RegionAttributesFactory;
-class AttributesMutator;
-class Cache;
-class Region;
-
 class APACHE_GEODE_EXPORT RegionAttributes
     : public internal::DataSerializableInternal {
   /**
diff --git a/cppcache/include/geode/internal/CacheableBuiltinTemplates.hpp b/cppcache/include/geode/internal/CacheableBuiltinTemplates.hpp
index 795c600..7ecf505 100644
--- a/cppcache/include/geode/internal/CacheableBuiltinTemplates.hpp
+++ b/cppcache/include/geode/internal/CacheableBuiltinTemplates.hpp
@@ -37,9 +37,8 @@ namespace internal {
  * Template class for primitive key types.
  */
 template <typename TObj, DSCode TYPEID>
-class APACHE_GEODE_EXPORT CacheableKeyPrimitive
-    : public DataSerializablePrimitive,
-      public CacheableKey {
+class CacheableKeyPrimitive : public virtual DataSerializablePrimitive,
+                              public virtual CacheableKey {
  private:
   TObj value_;
 
@@ -86,25 +85,24 @@ class APACHE_GEODE_EXPORT CacheableKeyPrimitive
   }
 
   /** Factory function registered with serialization registry. */
-  static std::shared_ptr<Serializable> createDeserializable() {
-    return std::make_shared<CacheableKeyPrimitive>();
+  inline static std::shared_ptr<Serializable> createDeserializable() {
+    return std::make_shared<CacheableKeyPrimitive<TObj, TYPEID>>();
   }
 
   /** Factory function to create a new default instance. */
-  inline static std::shared_ptr<CacheableKeyPrimitive> create() {
-    return std::make_shared<CacheableKeyPrimitive>();
+  inline static std::shared_ptr<CacheableKeyPrimitive<TObj, TYPEID>> create()
{
+    return std::make_shared<CacheableKeyPrimitive<TObj, TYPEID>>();
   }
 
   /** Factory function to create an instance with the given value. */
-  inline static std::shared_ptr<CacheableKeyPrimitive> create(
+  inline static std::shared_ptr<CacheableKeyPrimitive<TObj, TYPEID>> create(
       const TObj value) {
-    return std::make_shared<CacheableKeyPrimitive>(value);
+    return std::make_shared<CacheableKeyPrimitive<TObj, TYPEID>>(value);
   }
 };
 
 template <typename T, DSCode GeodeTypeId>
-class APACHE_GEODE_EXPORT CacheableArrayPrimitive
-    : public DataSerializablePrimitive {
+class CacheableArrayPrimitive : public DataSerializablePrimitive {
  protected:
   DSCode getDsCode() const override { return GeodeTypeId; }
 
@@ -173,9 +171,8 @@ class APACHE_GEODE_EXPORT CacheableArrayPrimitive
 
 /** Template class for container Cacheable types. */
 template <typename TBase, DSCode TYPEID, class _Derived>
-class APACHE_GEODE_EXPORT CacheableContainerPrimitive
-    : public DataSerializablePrimitive,
-      public TBase {
+class CacheableContainerPrimitive : public DataSerializablePrimitive,
+                                    public TBase {
  public:
   inline CacheableContainerPrimitive() : TBase() {}
 
diff --git a/cppcache/include/geode/internal/DataSerializablePrimitive.hpp b/cppcache/include/geode/internal/DataSerializablePrimitive.hpp
index 0d1a0b7..8d6e82d 100644
--- a/cppcache/include/geode/internal/DataSerializablePrimitive.hpp
+++ b/cppcache/include/geode/internal/DataSerializablePrimitive.hpp
@@ -35,7 +35,7 @@ namespace internal {
 class APACHE_GEODE_EXPORT DataSerializablePrimitive
     : public virtual Serializable {
  public:
-  ~DataSerializablePrimitive() override = default;
+  ~DataSerializablePrimitive() noexcept override = default;
   virtual void toData(DataOutput& dataOutput) const = 0;
   virtual void fromData(DataInput& dataInput) = 0;
   virtual DSCode getDsCode() const = 0;
diff --git a/cppcache/integration-test-2/CMakeLists.txt b/cppcache/integration-test-2/CMakeLists.txt
index 422d393..322550c 100644
--- a/cppcache/integration-test-2/CMakeLists.txt
+++ b/cppcache/integration-test-2/CMakeLists.txt
@@ -76,7 +76,10 @@ if(WIN32)
 endif()
 
 set_target_properties(integration-test-2 PROPERTIES
-	FOLDER cpp/test/integration)
+  CXX_VISIBILITY_PRESET hidden
+  VISIBILITY_INLINES_HIDDEN ON
+  FOLDER cpp/test/integration
+)
 
 add_clangformat(integration-test-2)
 
diff --git a/cppcache/integration-test/CMakeLists.txt b/cppcache/integration-test/CMakeLists.txt
index 841a722..fc52ad6 100644
--- a/cppcache/integration-test/CMakeLists.txt
+++ b/cppcache/integration-test/CMakeLists.txt
@@ -92,7 +92,11 @@ foreach(FILE ${SOURCES})
   set(TESTS ${TESTS} ${TEST})
   add_dependencies(integration-tests ${TEST})
   add_executable(${TEST} ${FILE})
-  set_target_properties(${TEST} PROPERTIES FOLDER cpp/test/integration/legacy)
+  set_target_properties(${TEST} PROPERTIES
+    CXX_VISIBILITY_PRESET hidden
+    VISIBILITY_INLINES_HIDDEN ON
+    FOLDER cpp/test/integration/legacy
+  )
 
   target_link_libraries(${TEST}
     PRIVATE
diff --git a/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index 4afa8c3..8ef89c7 100644
--- a/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -22,6 +22,7 @@
 
 #include <geode/RegionShortcut.hpp>
 #include <geode/RegionFactory.hpp>
+#include <geode/PersistenceManager.hpp>
 
 #include <CacheableToken.hpp>
 #include <CacheRegionHelper.hpp>
diff --git a/cppcache/shared/CMakeLists.txt b/cppcache/shared/CMakeLists.txt
index 015b24d..09c11ec 100644
--- a/cppcache/shared/CMakeLists.txt
+++ b/cppcache/shared/CMakeLists.txt
@@ -18,11 +18,20 @@ project(apache-geode LANGUAGES CXX)
 
 add_library(apache-geode SHARED ${SOURCES_ALL} ${RESOURCES})
 
-if (WIN32)
-  set(EXPORT_HEADER_CUSTOM_CONTENT "#define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT APACHE_GEODE_EXPORT")
+if (MSVC)
+  set(EXPORT_HEADER_CUSTOM_CONTENT "
+#define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT APACHE_GEODE_EXPORT
+
+#define APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+")
 else()
-  set(EXPORT_HEADER_CUSTOM_CONTENT "#define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT")
+  set(EXPORT_HEADER_CUSTOM_CONTENT "
+#define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+
+#define APACHE_GEODE_EXTERN_TEMPLATE_EXPORT APACHE_GEODE_EXPORT
+")
 endif()
+
 include(GenerateExportHeader)
 generate_export_header(apache-geode
   EXPORT_FILE_NAME ${EXPORT_FILE_NAME}
@@ -50,11 +59,6 @@ set_target_properties(apache-geode PROPERTIES
   FOLDER cpp
   )
 
-if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-  set_target_properties(apache-geode PROPERTIES
-    CXX_VISIBILITY_PRESET default)
-endif()
-
 add_dependencies(client-libraries apache-geode)
 
 install(TARGETS apache-geode
diff --git a/cppcache/src/CacheableBuiltins.cpp b/cppcache/src/CacheableBuiltins.cpp
index a994a6c..1b2dd21 100644
--- a/cppcache/src/CacheableBuiltins.cpp
+++ b/cppcache/src/CacheableBuiltins.cpp
@@ -20,17 +20,45 @@
 namespace apache {
 namespace geode {
 namespace client {
+namespace internal {
 
-#define _GF_CACHEABLE_KEY_DEF_(k) const char tName_##k[] = #k;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<bool, DSCode::CacheableBoolean>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<int8_t, DSCode::CacheableByte>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<double, DSCode::CacheableDouble>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<float, DSCode::CacheableFloat>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<int16_t, DSCode::CacheableInt16>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<int32_t, DSCode::CacheableInt32>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<int64_t, DSCode::CacheableInt64>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableKeyPrimitive<char16_t, DSCode::CacheableCharacter>;
 
-_GF_CACHEABLE_KEY_DEF_(CacheableBoolean)
-_GF_CACHEABLE_KEY_DEF_(CacheableByte)
-_GF_CACHEABLE_KEY_DEF_(CacheableDouble)
-_GF_CACHEABLE_KEY_DEF_(CacheableFloat)
-_GF_CACHEABLE_KEY_DEF_(CacheableInt16)
-_GF_CACHEABLE_KEY_DEF_(CacheableInt32)
-_GF_CACHEABLE_KEY_DEF_(CacheableInt64)
-_GF_CACHEABLE_KEY_DEF_(CacheableCharacter)
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<int8_t, DSCode::CacheableBytes>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<bool, DSCode::BooleanArray>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<char16_t, DSCode::CharArray>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<double, DSCode::CacheableDoubleArray>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<float, DSCode::CacheableFloatArray>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<int16_t, DSCode::CacheableInt16Array>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<int32_t, DSCode::CacheableInt32Array>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
+    CacheableArrayPrimitive<int64_t, DSCode::CacheableInt64Array>;
+template class APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT CacheableArrayPrimitive<
+    std::shared_ptr<CacheableString>, DSCode::CacheableStringArray>;
+
+}  // namespace internal
 }  // namespace client
 }  // namespace geode
 }  // namespace apache
diff --git a/cppcache/src/PdxInstanceImpl.cpp b/cppcache/src/PdxInstanceImpl.cpp
index 6894a8d..cbaf8b6 100644
--- a/cppcache/src/PdxInstanceImpl.cpp
+++ b/cppcache/src/PdxInstanceImpl.cpp
@@ -157,8 +157,7 @@ void PdxInstanceImpl::writeField(PdxWriter& writer,
       break;
     }
     case PdxFieldTypes::BYTE_ARRAY: {
-      if (auto&& val = std::dynamic_pointer_cast<
-              CacheableArrayPrimitive<int8_t, DSCode::CacheableBytes>>(value)) {
+      if (auto&& val = std::dynamic_pointer_cast<CacheableBytes>(value)) {
         writer.writeByteArray(fieldName, val->value());
       }
       break;
diff --git a/cppcache/src/RegionAttributes.cpp b/cppcache/src/RegionAttributes.cpp
index 3d542fa..f696f12 100644
--- a/cppcache/src/RegionAttributes.cpp
+++ b/cppcache/src/RegionAttributes.cpp
@@ -24,6 +24,7 @@
 #include <geode/Cache.hpp>
 #include <geode/DataInput.hpp>
 #include <geode/DataOutput.hpp>
+#include <geode/PersistenceManager.hpp>
 #include <geode/Properties.hpp>
 
 #include "CacheXmlParser.hpp"
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 188b600..6b7ee76 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -2450,7 +2450,7 @@ TcrMessageExecuteRegionFunctionSingleHop::
       LOGDEBUG("All Buckets so putting IntPart for buckets = %d ",
                routingObj->size());
       for (const auto& itr : *routingObj) {
-        writeIntPart(std::static_pointer_cast<CacheableInt32>(itr)->value());
+        writeIntPart(std::dynamic_pointer_cast<CacheableInt32>(itr)->value());
       }
     } else {
       LOGDEBUG("putting keys as withFilter called, routing Keys size = %d ",


Mime
View raw message