From 20e996c4c1304d2e9935e4ca9e9a9dd3d31537b2 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Tue, 5 May 2026 14:46:11 +0200 Subject: [PATCH] [Type] Standardize extern template instantiations for vector --- Sofa/framework/Type/src/sofa/type/vector_Integral.cpp | 2 +- Sofa/framework/Type/src/sofa/type/vector_Integral.h | 11 +++++++++++ Sofa/framework/Type/src/sofa/type/vector_Real.cpp | 1 + Sofa/framework/Type/src/sofa/type/vector_Real.h | 4 ++++ Sofa/framework/Type/src/sofa/type/vector_String.cpp | 2 +- Sofa/framework/Type/src/sofa/type/vector_String.h | 3 +++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Sofa/framework/Type/src/sofa/type/vector_Integral.cpp b/Sofa/framework/Type/src/sofa/type/vector_Integral.cpp index ff62af83f67..51f6b40ab6a 100644 --- a/Sofa/framework/Type/src/sofa/type/vector_Integral.cpp +++ b/Sofa/framework/Type/src/sofa/type/vector_Integral.cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#define SOFA_HELPER_VECTOR_INTEGRAL_DEFINITION +#define SOFA_TYPE_VECTOR_INTEGRAL_CPP #include #include diff --git a/Sofa/framework/Type/src/sofa/type/vector_Integral.h b/Sofa/framework/Type/src/sofa/type/vector_Integral.h index 15529481471..ca7223cc2cf 100644 --- a/Sofa/framework/Type/src/sofa/type/vector_Integral.h +++ b/Sofa/framework/Type/src/sofa/type/vector_Integral.h @@ -30,3 +30,14 @@ template<> SOFA_TYPE_API std::istream& sofa::type::vector::read( s template<> SOFA_TYPE_API std::ostream& sofa::type::vector::write(std::ostream& os) const; template<> SOFA_TYPE_API std::istream& sofa::type::vector::read(std::istream& in); +#if !defined(SOFA_TYPE_VECTOR_INTEGRAL_CPP) +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +#endif diff --git a/Sofa/framework/Type/src/sofa/type/vector_Real.cpp b/Sofa/framework/Type/src/sofa/type/vector_Real.cpp index 6b60cfea516..b245bbb1223 100644 --- a/Sofa/framework/Type/src/sofa/type/vector_Real.cpp +++ b/Sofa/framework/Type/src/sofa/type/vector_Real.cpp @@ -19,6 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#define SOFA_TYPE_VECTOR_REAL_CPP #include #include diff --git a/Sofa/framework/Type/src/sofa/type/vector_Real.h b/Sofa/framework/Type/src/sofa/type/vector_Real.h index b691b35fc93..d2b425482f2 100644 --- a/Sofa/framework/Type/src/sofa/type/vector_Real.h +++ b/Sofa/framework/Type/src/sofa/type/vector_Real.h @@ -22,3 +22,7 @@ #pragma once #include +#if !defined(SOFA_TYPE_VECTOR_REAL_CPP) +extern template class SOFA_TYPE_API sofa::type::vector; +extern template class SOFA_TYPE_API sofa::type::vector; +#endif diff --git a/Sofa/framework/Type/src/sofa/type/vector_String.cpp b/Sofa/framework/Type/src/sofa/type/vector_String.cpp index 1ef2bbb2b4b..bcf61f3b6a2 100644 --- a/Sofa/framework/Type/src/sofa/type/vector_String.cpp +++ b/Sofa/framework/Type/src/sofa/type/vector_String.cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#define SOFA_HELPER_VECTOR_STRING_DEFINITION +#define SOFA_TYPE_VECTOR_STRING_CPP #include #include diff --git a/Sofa/framework/Type/src/sofa/type/vector_String.h b/Sofa/framework/Type/src/sofa/type/vector_String.h index 74a6a37c6ed..f1c32c48328 100644 --- a/Sofa/framework/Type/src/sofa/type/vector_String.h +++ b/Sofa/framework/Type/src/sofa/type/vector_String.h @@ -24,3 +24,6 @@ template<> SOFA_TYPE_API std::ostream& sofa::type::vector::write(std::ostream& os) const; +#if !defined(SOFA_TYPE_VECTOR_STRING_CPP) +extern template class SOFA_TYPE_API sofa::type::vector; +#endif