# HG changeset patch # User Markus Mützel # Date 1609259545 -3600 # Node ID 3ef055ca1d5e3b619bc51ec563d9021914f007f5 # Parent a65ff1d4f75b4ebbfe743b8791072ead68993599 Export template class definition instead of template class instantiations (patch #8919). * MArray.h (MArray), DiagArray2.h (DiagArray2), MDiagArray2.h (MDiagArray2), Range.h (range): 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. diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/DiagArray2.h --- 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 class +OCTAVE_API DiagArray2 : protected Array { protected: diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MArray-C.cc --- 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; +template class MArray; INSTANTIATE_MARRAY_FRIENDS (Complex, OCTAVE_API) #include "MDiagArray2.h" #include "MDiagArray2.cc" -template class OCTAVE_API MDiagArray2; +template class MDiagArray2; INSTANTIATE_MDIAGARRAY2_FRIENDS (Complex, OCTAVE_API) diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MArray-d.cc --- 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; +template class MArray; INSTANTIATE_MARRAY_FRIENDS (double, OCTAVE_API) #include "MDiagArray2.h" #include "MDiagArray2.cc" -template class OCTAVE_API MDiagArray2; +template class MDiagArray2; INSTANTIATE_MDIAGARRAY2_FRIENDS (double, OCTAVE_API) diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MArray-f.cc --- 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; +template class MArray; INSTANTIATE_MARRAY_FRIENDS (float, OCTAVE_API) #include "MDiagArray2.h" #include "MDiagArray2.cc" -template class OCTAVE_API MDiagArray2; +template class MDiagArray2; INSTANTIATE_MDIAGARRAY2_FRIENDS (float, OCTAVE_API) diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MArray-fC.cc --- 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; +template class MArray; INSTANTIATE_MARRAY_FRIENDS (FloatComplex, OCTAVE_API) #include "MDiagArray2.h" #include "MDiagArray2.cc" -template class OCTAVE_API MDiagArray2; +template class MDiagArray2; INSTANTIATE_MDIAGARRAY2_FRIENDS (FloatComplex, OCTAVE_API) diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MArray-i.cc --- 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; +template class MArray; #if defined (OCTAVE_ENABLE_64) -template class OCTAVE_API MArray; +template class MArray; #endif INSTANTIATE_MARRAY_FRIENDS (int, OCTAVE_API) @@ -44,20 +44,20 @@ INSTANTIATE_MARRAY_FRIENDS (int64_t, OCTAVE_API) #endif -template class OCTAVE_API MArray; -template class OCTAVE_API MArray; -template class OCTAVE_API MArray; -template class OCTAVE_API MArray; +template class MArray; +template class MArray; +template class MArray; +template class MArray; 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; -template class OCTAVE_API MArray; -template class OCTAVE_API MArray; -template class OCTAVE_API MArray; +template class MArray; +template class MArray; +template class MArray; +template class MArray; 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; +template class MDiagArray2; INSTANTIATE_MDIAGARRAY2_FRIENDS (int, OCTAVE_API) diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MArray-s.cc --- 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; +template class MArray; INSTANTIATE_MARRAY_FRIENDS (short, OCTAVE_API) #include "MDiagArray2.h" #include "MDiagArray2.cc" -template class OCTAVE_API MDiagArray2; +template class MDiagArray2; INSTANTIATE_MDIAGARRAY2_FRIENDS (short, OCTAVE_API) diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MArray.h --- 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 class +OCTAVE_API MArray : public Array { protected: diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MDiagArray2.h --- 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 class +OCTAVE_API MDiagArray2 : public DiagArray2 { public: diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MSparse-C.cc --- 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; +template class MSparse; INSTANTIATE_SPARSE_FRIENDS (Complex, OCTAVE_API); diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/MSparse-d.cc --- 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; +template class MSparse; INSTANTIATE_SPARSE_FRIENDS (double, OCTAVE_API); diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/Range.h --- 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 - 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::all_elements_are_ints (void) const; - template <> bool range::all_elements_are_ints (void) const; + template <> OCTAVE_API bool range::all_elements_are_ints (void) const; + template <> OCTAVE_API bool range::all_elements_are_ints (void) const; - template <> octave_idx_type range::get_numel (void) const; - template <> octave_idx_type range::get_numel (void) const; + template <> OCTAVE_API octave_idx_type range::get_numel (void) const; + template <> OCTAVE_API octave_idx_type range::get_numel (void) const; - template <> double range::get_final_value (void) const; - template <> float range::get_final_value (void) const; + template <> OCTAVE_API double range::get_final_value (void) const; + template <> OCTAVE_API float range::get_final_value (void) const; - template <> octave_idx_type range::nnz (void) const; + template <> OCTAVE_API octave_idx_type range::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& sidx, bool ascending = true); + OCTAVE_API void sort_internal (bool ascending = true); + OCTAVE_API void sort_internal (Array& 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& sidx, octave_idx_type dim = 0, + OCTAVE_API Range sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const; + OCTAVE_API Range sort (Array& 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 index (const idx_vector& i) const; + OCTAVE_API Array 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: diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/int16NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream& diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/int32NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream& diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/int64NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream& diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/int8NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream& diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/intNDArray.h --- 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 class +OCTAVE_API intNDArray : public MArray { public: @@ -130,9 +131,11 @@ // i/o template +OCTAVE_API std::ostream& operator << (std::ostream& os, const intNDArray& a); template +OCTAVE_API std::istream& operator >> (std::istream& is, intNDArray& a); #endif diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/uint16NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream& diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/uint32NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream& diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/uint64NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream& diff -r a65ff1d4f75b -r 3ef055ca1d5e liboctave/array/uint8NDArray.cc --- 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; +template class intNDArray; template OCTAVE_API std::ostream&