changeset 29226:3ef055ca1d5e

Export template class definition instead of template class instantiations (patch #8919). * MArray.h (MArray<T>), DiagArray2.h (DiagArray2<T>), MDiagArray2.h (MDiagArray2<T>), Range.h (range<T>): Mark template class definition for export/import. * int16NDArray.cc, int32NDArray.cc, int64NDArray.cc, int8NDArray.cc, uint16NDArray.cc, uint32NDArray.cc, uint64NDArray.cc, uint8NDArray.cc, MArray-C.cc, MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MSparse-C.cc, MSparse-d.cc: Do not mark template class instantiations for export.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 29 Dec 2020 17:32:25 +0100
parents a65ff1d4f75b
children a009cb8ef68f
files liboctave/array/DiagArray2.h liboctave/array/MArray-C.cc liboctave/array/MArray-d.cc liboctave/array/MArray-f.cc liboctave/array/MArray-fC.cc liboctave/array/MArray-i.cc liboctave/array/MArray-s.cc liboctave/array/MArray.h liboctave/array/MDiagArray2.h liboctave/array/MSparse-C.cc liboctave/array/MSparse-d.cc liboctave/array/Range.h liboctave/array/int16NDArray.cc liboctave/array/int32NDArray.cc liboctave/array/int64NDArray.cc liboctave/array/int8NDArray.cc liboctave/array/intNDArray.h liboctave/array/uint16NDArray.cc liboctave/array/uint32NDArray.cc liboctave/array/uint64NDArray.cc liboctave/array/uint8NDArray.cc
diffstat 21 files changed, 69 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/DiagArray2.h	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/DiagArray2.h	Tue Dec 29 17:32:25 2020 +0100
@@ -38,6 +38,7 @@
 
 template <typename T>
 class
+OCTAVE_API
 DiagArray2 : protected Array<T>
 {
 protected:
--- a/liboctave/array/MArray-C.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MArray-C.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -34,13 +34,13 @@
 #include "MArray.h"
 #include "MArray.cc"
 
-template class OCTAVE_API MArray<Complex>;
+template class MArray<Complex>;
 
 INSTANTIATE_MARRAY_FRIENDS (Complex, OCTAVE_API)
 
 #include "MDiagArray2.h"
 #include "MDiagArray2.cc"
 
-template class OCTAVE_API MDiagArray2<Complex>;
+template class MDiagArray2<Complex>;
 
 INSTANTIATE_MDIAGARRAY2_FRIENDS (Complex, OCTAVE_API)
--- a/liboctave/array/MArray-d.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MArray-d.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -32,13 +32,13 @@
 #include "MArray.h"
 #include "MArray.cc"
 
-template class OCTAVE_API MArray<double>;
+template class MArray<double>;
 
 INSTANTIATE_MARRAY_FRIENDS (double, OCTAVE_API)
 
 #include "MDiagArray2.h"
 #include "MDiagArray2.cc"
 
-template class OCTAVE_API MDiagArray2<double>;
+template class MDiagArray2<double>;
 
 INSTANTIATE_MDIAGARRAY2_FRIENDS (double, OCTAVE_API)
--- a/liboctave/array/MArray-f.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MArray-f.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -32,13 +32,13 @@
 #include "MArray.h"
 #include "MArray.cc"
 
-template class OCTAVE_API MArray<float>;
+template class MArray<float>;
 
 INSTANTIATE_MARRAY_FRIENDS (float, OCTAVE_API)
 
 #include "MDiagArray2.h"
 #include "MDiagArray2.cc"
 
-template class OCTAVE_API MDiagArray2<float>;
+template class MDiagArray2<float>;
 
 INSTANTIATE_MDIAGARRAY2_FRIENDS (float, OCTAVE_API)
--- a/liboctave/array/MArray-fC.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MArray-fC.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -34,13 +34,13 @@
 #include "MArray.h"
 #include "MArray.cc"
 
-template class OCTAVE_API MArray<FloatComplex>;
+template class MArray<FloatComplex>;
 
 INSTANTIATE_MARRAY_FRIENDS (FloatComplex, OCTAVE_API)
 
 #include "MDiagArray2.h"
 #include "MDiagArray2.cc"
 
-template class OCTAVE_API MDiagArray2<FloatComplex>;
+template class MDiagArray2<FloatComplex>;
 
 INSTANTIATE_MDIAGARRAY2_FRIENDS (FloatComplex, OCTAVE_API)
--- a/liboctave/array/MArray-i.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MArray-i.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -34,9 +34,9 @@
 #include "MArray.h"
 #include "MArray.cc"
 
-template class OCTAVE_API MArray<int>;
+template class MArray<int>;
 #if defined (OCTAVE_ENABLE_64)
-template class OCTAVE_API MArray<int64_t>;
+template class MArray<int64_t>;
 #endif
 
 INSTANTIATE_MARRAY_FRIENDS (int, OCTAVE_API)
@@ -44,20 +44,20 @@
 INSTANTIATE_MARRAY_FRIENDS (int64_t, OCTAVE_API)
 #endif
 
-template class OCTAVE_API MArray<octave_int8>;
-template class OCTAVE_API MArray<octave_int16>;
-template class OCTAVE_API MArray<octave_int32>;
-template class OCTAVE_API MArray<octave_int64>;
+template class MArray<octave_int8>;
+template class MArray<octave_int16>;
+template class MArray<octave_int32>;
+template class MArray<octave_int64>;
 
 INSTANTIATE_MARRAY_FRIENDS (octave_int8, OCTAVE_API)
 INSTANTIATE_MARRAY_FRIENDS (octave_int16, OCTAVE_API)
 INSTANTIATE_MARRAY_FRIENDS (octave_int32, OCTAVE_API)
 INSTANTIATE_MARRAY_FRIENDS (octave_int64, OCTAVE_API)
 
-template class OCTAVE_API MArray<octave_uint8>;
-template class OCTAVE_API MArray<octave_uint16>;
-template class OCTAVE_API MArray<octave_uint32>;
-template class OCTAVE_API MArray<octave_uint64>;
+template class MArray<octave_uint8>;
+template class MArray<octave_uint16>;
+template class MArray<octave_uint32>;
+template class MArray<octave_uint64>;
 
 INSTANTIATE_MARRAY_FRIENDS (octave_uint8, OCTAVE_API)
 INSTANTIATE_MARRAY_FRIENDS (octave_uint16, OCTAVE_API)
@@ -67,6 +67,6 @@
 #include "MDiagArray2.h"
 #include "MDiagArray2.cc"
 
-template class OCTAVE_API MDiagArray2<int>;
+template class MDiagArray2<int>;
 
 INSTANTIATE_MDIAGARRAY2_FRIENDS (int, OCTAVE_API)
--- a/liboctave/array/MArray-s.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MArray-s.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -32,13 +32,13 @@
 #include "MArray.h"
 #include "MArray.cc"
 
-template class OCTAVE_API MArray<short>;
+template class MArray<short>;
 
 INSTANTIATE_MARRAY_FRIENDS (short, OCTAVE_API)
 
 #include "MDiagArray2.h"
 #include "MDiagArray2.cc"
 
-template class OCTAVE_API MDiagArray2<short>;
+template class MDiagArray2<short>;
 
 INSTANTIATE_MDIAGARRAY2_FRIENDS (short, OCTAVE_API)
--- a/liboctave/array/MArray.h	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MArray.h	Tue Dec 29 17:32:25 2020 +0100
@@ -59,6 +59,7 @@
 //! Template for N-dimensional array classes with like-type math operators.
 template <typename T>
 class
+OCTAVE_API
 MArray : public Array<T>
 {
 protected:
--- a/liboctave/array/MDiagArray2.h	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MDiagArray2.h	Tue Dec 29 17:32:25 2020 +0100
@@ -51,6 +51,7 @@
 //! Template for two dimensional diagonal array with math operators.
 template <typename T>
 class
+OCTAVE_API
 MDiagArray2 : public DiagArray2<T>
 {
 public:
--- a/liboctave/array/MSparse-C.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MSparse-C.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -31,6 +31,6 @@
 
 #include "MSparse.h"
 
-template class OCTAVE_API MSparse<Complex>;
+template class MSparse<Complex>;
 
 INSTANTIATE_SPARSE_FRIENDS (Complex, OCTAVE_API);
--- a/liboctave/array/MSparse-d.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/MSparse-d.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -29,6 +29,6 @@
 
 #include "MSparse.h"
 
-template class OCTAVE_API MSparse<double>;
+template class MSparse<double>;
 
 INSTANTIATE_SPARSE_FRIENDS (double, OCTAVE_API);
--- a/liboctave/array/Range.h	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/Range.h	Tue Dec 29 17:32:25 2020 +0100
@@ -67,7 +67,9 @@
   };
 
   template <typename T>
-  class range
+  class
+  OCTAVE_API
+  range
   {
   public:
 
@@ -195,7 +197,7 @@
       return mode;
     }
 
-    octave_idx_type nnz (void) const;
+    OCTAVE_API octave_idx_type nnz (void) const;
 
     // Support for single-index subscripting, without generating matrix cache.
 
@@ -343,20 +345,19 @@
 
   // Specializations defined externally.
 
-  template <> bool range<double>::all_elements_are_ints (void) const;
-  template <> bool range<float>::all_elements_are_ints (void) const;
+  template <> OCTAVE_API bool range<double>::all_elements_are_ints (void) const;
+  template <> OCTAVE_API bool range<float>::all_elements_are_ints (void) const;
 
-  template <> octave_idx_type range<double>::get_numel (void) const;
-  template <> octave_idx_type range<float>::get_numel (void) const;
+  template <> OCTAVE_API octave_idx_type range<double>::get_numel (void) const;
+  template <> OCTAVE_API octave_idx_type range<float>::get_numel (void) const;
 
-  template <> double range<double>::get_final_value (void) const;
-  template <> float range<float>::get_final_value (void) const;
+  template <> OCTAVE_API double range<double>::get_final_value (void) const;
+  template <> OCTAVE_API float range<float>::get_final_value (void) const;
 
-  template <> octave_idx_type range<double>::nnz (void) const;
+  template <> OCTAVE_API octave_idx_type range<double>::nnz (void) const;
 }
 
 class
-OCTAVE_API
 Range
 {
 public:
@@ -445,32 +446,32 @@
 
   bool isempty (void) const { return numel () == 0; }
 
-  bool all_elements_are_ints (void) const;
+  OCTAVE_API bool all_elements_are_ints (void) const;
 
-  Matrix matrix_value (void) const;
+  OCTAVE_API Matrix matrix_value (void) const;
 
-  double min (void) const;
-  double max (void) const;
+  OCTAVE_API double min (void) const;
+  OCTAVE_API double max (void) const;
 
-  void sort_internal (bool ascending = true);
-  void sort_internal (Array<octave_idx_type>& sidx, bool ascending = true);
+  OCTAVE_API void sort_internal (bool ascending = true);
+  OCTAVE_API void sort_internal (Array<octave_idx_type>& sidx, bool ascending = true);
 
-  Matrix diag (octave_idx_type k = 0) const;
+  OCTAVE_API Matrix diag (octave_idx_type k = 0) const;
 
-  Range sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
-  Range sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0,
+  OCTAVE_API Range sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
+  OCTAVE_API Range sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0,
               sortmode mode = ASCENDING) const;
 
-  sortmode issorted (sortmode mode = ASCENDING) const;
+  OCTAVE_API sortmode issorted (sortmode mode = ASCENDING) const;
 
-  octave_idx_type nnz (void) const;
+  OCTAVE_API octave_idx_type nnz (void) const;
 
   // Support for single-index subscripting, without generating matrix cache.
 
-  double checkelem (octave_idx_type i) const;
-  double checkelem (octave_idx_type i, octave_idx_type j) const;
+  OCTAVE_API double checkelem (octave_idx_type i) const;
+  OCTAVE_API double checkelem (octave_idx_type i, octave_idx_type j) const;
 
-  double elem (octave_idx_type i) const;
+  OCTAVE_API double elem (octave_idx_type i) const;
   double elem (octave_idx_type /* i */, octave_idx_type j) const
   { return elem (j); }
 
@@ -478,13 +479,13 @@
   double operator () (octave_idx_type i, octave_idx_type j) const
   { return elem (i, j); }
 
-  Array<double> index (const idx_vector& i) const;
+  OCTAVE_API Array<double> index (const idx_vector& i) const;
 
-  void set_base (double b);
+  OCTAVE_API void set_base (double b);
 
-  void set_limit (double l);
+  OCTAVE_API void set_limit (double l);
 
-  void set_inc (double i);
+  OCTAVE_API void set_inc (double i);
 
   friend OCTAVE_API std::ostream& operator << (std::ostream& os,
                                                const Range& r);
@@ -506,11 +507,11 @@
 
   octave_idx_type m_numel;
 
-  octave_idx_type numel_internal (void) const;
+  OCTAVE_API octave_idx_type numel_internal (void) const;
 
-  double limit_internal (void) const;
+  OCTAVE_API double limit_internal (void) const;
 
-  void init (void);
+  OCTAVE_API void init (void);
 
 protected:
 
--- a/liboctave/array/int16NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/int16NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_int16>;
+template class intNDArray<octave_int16>;
 
 template OCTAVE_API
 std::ostream&
--- a/liboctave/array/int32NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/int32NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_int32>;
+template class intNDArray<octave_int32>;
 
 template OCTAVE_API
 std::ostream&
--- a/liboctave/array/int64NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/int64NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_int64>;
+template class intNDArray<octave_int64>;
 
 template OCTAVE_API
 std::ostream&
--- a/liboctave/array/int8NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/int8NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_int8>;
+template class intNDArray<octave_int8>;
 
 template OCTAVE_API
 std::ostream&
--- a/liboctave/array/intNDArray.h	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/intNDArray.h	Tue Dec 29 17:32:25 2020 +0100
@@ -35,6 +35,7 @@
 
 template <typename T>
 class
+OCTAVE_API
 intNDArray : public MArray<T>
 {
 public:
@@ -130,9 +131,11 @@
 // i/o
 
 template <typename T>
+OCTAVE_API
 std::ostream& operator << (std::ostream& os, const intNDArray<T>& a);
 
 template <typename T>
+OCTAVE_API
 std::istream& operator >> (std::istream& is, intNDArray<T>& a);
 
 #endif
--- a/liboctave/array/uint16NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/uint16NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_uint16>;
+template class intNDArray<octave_uint16>;
 
 template OCTAVE_API
 std::ostream&
--- a/liboctave/array/uint32NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/uint32NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_uint32>;
+template class intNDArray<octave_uint32>;
 
 template OCTAVE_API
 std::ostream&
--- a/liboctave/array/uint64NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/uint64NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_uint64>;
+template class intNDArray<octave_uint64>;
 
 template OCTAVE_API
 std::ostream&
--- a/liboctave/array/uint8NDArray.cc	Tue Dec 29 17:19:47 2020 +0100
+++ b/liboctave/array/uint8NDArray.cc	Tue Dec 29 17:32:25 2020 +0100
@@ -33,7 +33,7 @@
 
 #include "bsxfun-defs.cc"
 
-template class OCTAVE_API intNDArray<octave_uint8>;
+template class intNDArray<octave_uint8>;
 
 template OCTAVE_API
 std::ostream&