# HG changeset patch # User Markus Mützel # Date 1609435234 -3600 # Thu Dec 31 18:20:34 2020 +0100 # Node ID 1dac958be94569e4cb7abfe05e2acda5d124ad3d # Parent 0a6ed9dcd601c6fc8c568d7d2eafac9b86b0443e Export template specializations and instantiations (patch #8919). diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/Array.cc --- a/liboctave/array/Array.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/Array.cc Thu Dec 31 18:20:34 2020 +0100 @@ -2467,19 +2467,19 @@ } #define NO_INSTANTIATE_ARRAY_SORT(T) \ - template <> Array \ + template <> OCTARRAY_API Array \ Array::sort (int, sortmode) const \ { \ return *this; \ } \ - template <> Array \ + template <> OCTARRAY_API Array \ Array::sort (Array &sidx, int, sortmode) const \ { \ sidx = Array (); \ return *this; \ } \ - template <> sortmode \ - Array::issorted (sortmode) const \ + template <> OCTARRAY_API sortmode \ + Array::issorted (sortmode) const \ { \ return UNSORTED; \ } \ @@ -2488,37 +2488,37 @@ { \ return nullptr; \ } \ - template <> Array \ + template <> OCTARRAY_API Array \ Array::sort_rows_idx (sortmode) const \ { \ return Array (); \ } \ - template <> sortmode \ + template <> OCTARRAY_API sortmode \ Array::is_sorted_rows (sortmode) const \ { \ return UNSORTED; \ } \ - template <> octave_idx_type \ + template <> OCTARRAY_API octave_idx_type \ Array::lookup (T const &, sortmode) const \ { \ return 0; \ } \ - template <> Array \ + template <> OCTARRAY_API Array \ Array::lookup (const Array&, sortmode) const \ { \ return Array (); \ } \ - template <> octave_idx_type \ + template <> OCTARRAY_API octave_idx_type \ Array::nnz (void) const \ { \ return 0; \ } \ - template <> Array \ + template <> OCTARRAY_API Array \ Array::find (octave_idx_type, bool) const \ { \ return Array (); \ } \ - template <> Array \ + template <> OCTARRAY_API Array \ Array::nth_element (const idx_vector&, int) const { \ return Array (); \ } @@ -2764,9 +2764,10 @@ T::__xXxXx__ (); } -#define INSTANTIATE_ARRAY(T) \ - template <> void Array::instantiation_guard () { } \ - template class Array +#define INSTANTIATE_ARRAY(T) \ + template <> OCTARRAY_API void \ + Array::instantiation_guard () { } \ + template class OCTARRAY_API Array // FIXME: is this used? diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/MArray-i.cc --- a/liboctave/array/MArray-i.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/MArray-i.cc Thu Dec 31 18:20:34 2020 +0100 @@ -44,20 +44,20 @@ INSTANTIATE_MARRAY_FRIENDS (int64_t, OCTAVE_API) #endif -template class MArray; -template class MArray; -template class MArray; -template class MArray; +template class OCTAVE_API MArray; +template class OCTAVE_API MArray; +template class OCTAVE_API MArray; +template class OCTAVE_API 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 MArray; -template class MArray; -template class MArray; -template class MArray; +template class OCTAVE_API MArray; +template class OCTAVE_API MArray; +template class OCTAVE_API MArray; +template class OCTAVE_API MArray; INSTANTIATE_MARRAY_FRIENDS (octave_uint8, OCTAVE_API) INSTANTIATE_MARRAY_FRIENDS (octave_uint16, OCTAVE_API) diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/Sparse-b.cc --- a/liboctave/array/Sparse-b.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/Sparse-b.cc Thu Dec 31 18:20:34 2020 +0100 @@ -40,7 +40,7 @@ return false; } -INSTANTIATE_SPARSE (bool, ); +INSTANTIATE_SPARSE (bool, OCTAVE_API); #if 0 template std::ostream& operator << (std::ostream&, const Sparse&); diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/int16NDArray.cc --- a/liboctave/array/int16NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/int16NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/int32NDArray.cc --- a/liboctave/array/int32NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/int32NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/int64NDArray.cc --- a/liboctave/array/int64NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/int64NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/int8NDArray.cc --- a/liboctave/array/int8NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/int8NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/uint16NDArray.cc --- a/liboctave/array/uint16NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/uint16NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/uint32NDArray.cc --- a/liboctave/array/uint32NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/uint32NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/uint64NDArray.cc --- a/liboctave/array/uint64NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/uint64NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/array/uint8NDArray.cc --- a/liboctave/array/uint8NDArray.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/array/uint8NDArray.cc Thu Dec 31 18:20:34 2020 +0100 @@ -33,7 +33,7 @@ #include "bsxfun-defs.cc" -template class intNDArray; +template class OCTAVE_API intNDArray; template OCTAVE_API std::ostream& diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/numeric/sparse-qr.cc --- a/liboctave/numeric/sparse-qr.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/numeric/sparse-qr.cc Thu Dec 31 18:20:34 2020 +0100 @@ -173,12 +173,6 @@ #endif } - // Instantiations we need. - - template class OCTAVE_API sparse_qr; - - template class OCTAVE_API sparse_qr; - // Specializations. // Real-valued matrices. @@ -2366,5 +2360,11 @@ SparseComplexMatrix> (a, b, info); } + + // Instantiations we need. + + template class OCTAVE_API sparse_qr; + + template class OCTAVE_API sparse_qr; } } diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/numeric/sparse-qr.h --- a/liboctave/numeric/sparse-qr.h Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/numeric/sparse-qr.h Thu Dec 31 18:20:34 2020 +0100 @@ -32,8 +32,8 @@ class Matrix; class ComplexMatrix; +class SparseMatrix; class SparseComplexMatrix; -class SparseMatrix; class ColumnVector; template class MArray; @@ -48,7 +48,7 @@ template class - sparse_qr + OCTAVE_API sparse_qr { public: @@ -98,6 +98,12 @@ wide_solve (const RHS_T& b, octave_idx_type& info) const; }; + // extern instantiations with set visibility is necessary for clang + + extern template class OCTAVE_API sparse_qr; + + extern template class OCTAVE_API sparse_qr; + // Provide qrsolve for backward compatibility. extern OCTAVE_API Matrix @@ -132,8 +138,8 @@ qrsolve (const SparseComplexMatrix& a, const SparseComplexMatrix& b, octave_idx_type& info); - //typedef sparse_qr SparseQR; - //typedef sparse_qr SparseComplexQR; + typedef sparse_qr SparseQR; + typedef sparse_qr SparseComplexQR; } } diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/util/lo-utils.cc --- a/liboctave/util/lo-utils.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/util/lo-utils.cc Thu Dec 31 18:20:34 2020 +0100 @@ -405,15 +405,24 @@ os << value; } - template void write_value (std::ostream& os, const bool& value); - template void write_value (std::ostream& os, const octave_int8& value); - template void write_value (std::ostream& os, const octave_int16& value); - template void write_value (std::ostream& os, const octave_int32& value); - template void write_value (std::ostream& os, const octave_int64& value); - template void write_value (std::ostream& os, const octave_uint8& value); - template void write_value (std::ostream& os, const octave_uint16& value); - template void write_value (std::ostream& os, const octave_uint32& value); - template void write_value (std::ostream& os, const octave_uint64& value); + template OCTAVE_API void + write_value (std::ostream& os, const bool& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_int8& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_int16& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_int32& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_int64& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_uint8& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_uint16& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_uint32& value); + template OCTAVE_API void + write_value (std::ostream& os, const octave_uint64& value); // Note: precision is supposed to be managed outside of this function by // setting stream parameters. diff -r 0a6ed9dcd601 -r 1dac958be945 liboctave/util/oct-inttypes.cc --- a/liboctave/util/oct-inttypes.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/util/oct-inttypes.cc Thu Dec 31 18:20:34 2020 +0100 @@ -78,8 +78,7 @@ #define INSTANTIATE_CONVERT_REAL_1(T, S) \ template \ - OCTAVE_API \ - T \ + OCTAVE_API T \ octave_int_base::convert_real (const S&) #define INSTANTIATE_CONVERT_REAL(S) \