changeset 29230:6b3faa844395

Set API tags in files in liboctave/util (patch #8919). Add API tag to template class definitions. Add API tag to (un-defined) functions and member functions in headers. Export template class instantiations and template functions from .cc files.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 29 Dec 2020 17:58:57 +0100
parents ed5eacd5c3ed
children 4e196fbb28a5
files liboctave/util/action-container.cc liboctave/util/action-container.h liboctave/util/file-info.h liboctave/util/lo-array-errwarn.h liboctave/util/lo-error.h liboctave/util/lo-hash.h liboctave/util/lo-utils.cc liboctave/util/lo-utils.h liboctave/util/oct-atomic.h liboctave/util/oct-glob.h liboctave/util/oct-inttypes.cc liboctave/util/oct-inttypes.h liboctave/util/oct-shlib.h liboctave/util/oct-sparse.h liboctave/util/oct-string.cc liboctave/util/oct-string.h liboctave/util/quit.h
diffstat 17 files changed, 205 insertions(+), 152 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/action-container.cc	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/action-container.cc	Tue Dec 29 17:58:57 2020 +0100
@@ -23,6 +23,10 @@
 //
 ////////////////////////////////////////////////////////////////////////
 
+#if defined (HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
 #include "action-container.h"
 #include "cmd-edit.h"
 
--- a/liboctave/util/action-container.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/action-container.h	Tue Dec 29 17:58:57 2020 +0100
@@ -193,7 +193,7 @@
 
     virtual void run_first (void) = 0;
 
-    void run (size_t num);
+    OCTAVE_API void run (size_t num);
 
     void run (void) { run (size ()); }
 
--- a/liboctave/util/file-info.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/file-info.h	Tue Dec 29 17:58:57 2020 +0100
@@ -62,9 +62,10 @@
 
     ~file_info (void) = default;
 
-    std::string get_line (size_t line) const;
+    OCTAVE_API std::string get_line (size_t line) const;
 
-    std::deque<std::string> get_lines (size_t line, size_t num_lines) const;
+    OCTAVE_API std::deque<std::string>
+    get_lines (size_t line, size_t num_lines) const;
 
     size_t num_lines (void) const { return m_offsets.size (); }
 
@@ -87,9 +88,10 @@
     sys::time m_timestamp;
 
     // Read entire file called fname and return the contents as a string
-    static std::string snarf_file (const std::string& fname);
+    static OCTAVE_API std::string snarf_file (const std::string& fname);
 
-    static std::vector<size_t> get_line_offsets (const std::string& buf);
+    static OCTAVE_API std::vector<size_t>
+    get_line_offsets (const std::string& buf);
   };
 }
 
--- a/liboctave/util/lo-array-errwarn.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/lo-array-errwarn.h	Tue Dec 29 17:58:57 2020 +0100
@@ -96,7 +96,7 @@
   protected:
 
     // Show what's wrong, e.g.,  A(-1,_), A(0+1i).
-    std::string expression (void) const;
+    OCTAVE_API std::string expression (void) const;
 
     // Number of dimensions of indexed object.
     octave_idx_type m_nd;
@@ -108,57 +108,57 @@
     std::string m_var;
   };
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_nan_to_logical_conversion (void);
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_nan_to_character_conversion (void);
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_nonconformant (const char *op, octave_idx_type op1_len,
                      octave_idx_type op2_len);
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_nonconformant (const char *op,
                      octave_idx_type op1_nr, octave_idx_type op1_nc,
                      octave_idx_type op2_nr, octave_idx_type op2_nc);
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_nonconformant (const char *op,
                      const dim_vector& op1_dims, const dim_vector& op2_dims);
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_index_out_of_range (int ndims, int dim, octave_idx_type idx,
                           octave_idx_type ext, const dim_vector& dv);
 
   OCTAVE_DEPRECATED (6, "use err_index_out_of_range (int, int, octave_idx_type, octave_idx_type, const dim_vector&) instead")
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_index_out_of_range (int ndims, int dim, octave_idx_type idx,
                           octave_idx_type ext);
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_del_index_out_of_range (bool is1d, octave_idx_type iext,
                               octave_idx_type ext);
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_invalid_index (double n, octave_idx_type nd = 0,
                      octave_idx_type dim = 0,
                      const std::string& var = "");
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_invalid_index (octave_idx_type n, octave_idx_type nd = 0,
                      octave_idx_type dim = 0,
                      const std::string& var = "");
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_invalid_index (const std::string& idx, octave_idx_type nd = 0,
                      octave_idx_type dim = 0,
                      const std::string& var = "");
 
-  OCTAVE_NORETURN OCTAVE_API extern void
+  OCTAVE_NORETURN extern OCTAVE_API void
   err_invalid_resize (void);
 
-  OCTAVE_API extern void
+  extern OCTAVE_API void
   warn_singular_matrix (double rcond = 0.0);
 }
 
--- a/liboctave/util/lo-error.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/lo-error.h	Tue Dec 29 17:58:57 2020 +0100
@@ -32,16 +32,16 @@
 extern "C" {
 #endif
 
-OCTAVE_NORETURN extern void
+OCTAVE_NORETURN extern OCTAVE_API void
 liboctave_fatal (const char *fmt, ...);
 
-OCTAVE_NORETURN extern
-void liboctave_fatal_with_id (const char *id, const char *fmt, ...);
+OCTAVE_NORETURN extern OCTAVE_API void
+liboctave_fatal_with_id (const char *id, const char *fmt, ...);
 
-extern void
+extern OCTAVE_API void
 liboctave_warning (const char *fmt, ...);
 
-extern void
+extern OCTAVE_API void
 liboctave_warning_with_id (const char *id, const char *fmt, ...);
 
 typedef void (*liboctave_error_handler) (const char *, ...);
@@ -57,30 +57,30 @@
 /* Would be nice to make these pointers private, but we want to share
    them among all the liboctave classes. */
 OCTAVE_FORMAT_PRINTF (1, 2)
-OCTAVE_NORETURN OCTAVE_API extern liboctave_error_handler
+OCTAVE_NORETURN extern OCTAVE_API liboctave_error_handler
   current_liboctave_error_handler;
 
 OCTAVE_FORMAT_PRINTF (2, 3)
-OCTAVE_NORETURN OCTAVE_API extern liboctave_error_with_id_handler
+OCTAVE_NORETURN extern OCTAVE_API liboctave_error_with_id_handler
   current_liboctave_error_with_id_handler;
 
 OCTAVE_FORMAT_PRINTF (1, 2)
-OCTAVE_API extern liboctave_warning_handler current_liboctave_warning_handler;
+extern OCTAVE_API liboctave_warning_handler current_liboctave_warning_handler;
 
 OCTAVE_FORMAT_PRINTF (2, 3)
-OCTAVE_API extern liboctave_warning_with_id_handler
+extern OCTAVE_API liboctave_warning_with_id_handler
   current_liboctave_warning_with_id_handler;
 
-OCTAVE_API extern void
+extern OCTAVE_API void
 set_liboctave_error_handler (OCTAVE_NORETURN liboctave_error_handler f);
 
-OCTAVE_API extern void
+extern OCTAVE_API void
 set_liboctave_error_with_id_handler (OCTAVE_NORETURN liboctave_error_with_id_handler f);
 
-OCTAVE_API extern void
+extern OCTAVE_API void
 set_liboctave_warning_handler (liboctave_warning_handler f);
 
-OCTAVE_API extern void
+extern OCTAVE_API void
 set_liboctave_warning_with_id_handler (liboctave_warning_with_id_handler f);
 
 #if defined (__cplusplus)
--- a/liboctave/util/lo-hash.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/lo-hash.h	Tue Dec 29 17:58:57 2020 +0100
@@ -36,28 +36,29 @@
   {
     typedef void * (hash_fptr) (const char *buffer, size_t len, void *res);
 
-    std::string
+    OCTAVE_API std::string
     hash (hash_fptr hash_fcn, const std::string& str, int result_buf_len);
 
-    int md2_digest_size (void);
-    int md4_digest_size (void);
-    int md5_digest_size (void);
-    int sha1_digest_size (void);
-    int sha224_digest_size (void);
-    int sha256_digest_size (void);
-    int sha384_digest_size (void);
-    int sha512_digest_size (void);
+    OCTAVE_API int md2_digest_size (void);
+    OCTAVE_API int md4_digest_size (void);
+    OCTAVE_API int md5_digest_size (void);
+    OCTAVE_API int sha1_digest_size (void);
+    OCTAVE_API int sha224_digest_size (void);
+    OCTAVE_API int sha256_digest_size (void);
+    OCTAVE_API int sha384_digest_size (void);
+    OCTAVE_API int sha512_digest_size (void);
 
-    std::string md2_hash (const std::string& str);
-    std::string md4_hash (const std::string& str);
-    std::string md5_hash (const std::string& str);
-    std::string sha1_hash (const std::string& str);
-    std::string sha224_hash (const std::string& str);
-    std::string sha256_hash (const std::string& str);
-    std::string sha384_hash (const std::string& str);
-    std::string sha512_hash (const std::string& str);
+    OCTAVE_API std::string md2_hash (const std::string& str);
+    OCTAVE_API std::string md4_hash (const std::string& str);
+    OCTAVE_API std::string md5_hash (const std::string& str);
+    OCTAVE_API std::string sha1_hash (const std::string& str);
+    OCTAVE_API std::string sha224_hash (const std::string& str);
+    OCTAVE_API std::string sha256_hash (const std::string& str);
+    OCTAVE_API std::string sha384_hash (const std::string& str);
+    OCTAVE_API std::string sha512_hash (const std::string& str);
 
-    std::string hash (const std::string& hash_type, const std::string& str);
+    OCTAVE_API std::string
+    hash (const std::string& hash_type, const std::string& str);
   }
 }
 
--- a/liboctave/util/lo-utils.cc	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/lo-utils.cc	Tue Dec 29 17:58:57 2020 +0100
@@ -43,6 +43,7 @@
 #include "lo-ieee.h"
 #include "lo-mappers.h"
 #include "lo-utils.h"
+#include "oct-inttypes.h"
 
 bool xis_int_or_inf_or_nan (double x)
 { return octave::math::isnan (x) || octave::math::x_nint (x) == x; }
@@ -178,6 +179,25 @@
 
 namespace octave
 {
+  template <typename T>
+  T
+  read_value (std::istream& is)
+  {
+    T retval;
+    is >> retval;
+    return retval;
+  }
+
+  template bool read_value<bool> (std::istream& is);
+  template octave_int8 read_value<octave_int8> (std::istream& is);
+  template octave_int16 read_value<octave_int16> (std::istream& is);
+  template octave_int32 read_value<octave_int32> (std::istream& is);
+  template octave_int64 read_value<octave_int64> (std::istream& is);
+  template octave_uint8 read_value<octave_uint8> (std::istream& is);
+  template octave_uint16 read_value<octave_uint16> (std::istream& is);
+  template octave_uint32 read_value<octave_uint32> (std::istream& is);
+  template octave_uint64 read_value<octave_uint64> (std::istream& is);
+
   // Note that the caller is responsible for repositioning the stream on
   // failure.
 
@@ -358,30 +378,47 @@
   // FIXME: Could we use traits and enable_if to avoid duplication in the
   // following specializations?
 
-  template <> double read_value (std::istream& is)
+  template <> OCTAVE_API double read_value (std::istream& is)
   {
     return read_fp_value<double> (is);
   }
 
-  template <> Complex read_value (std::istream& is)
+  template <> OCTAVE_API Complex read_value (std::istream& is)
   {
     return read_cx_fp_value<double> (is);
   }
 
-  template <> float read_value (std::istream& is)
+  template <> OCTAVE_API float read_value (std::istream& is)
   {
     return read_fp_value<float> (is);
   }
 
-  template <> FloatComplex read_value (std::istream& is)
+  template <> OCTAVE_API FloatComplex read_value (std::istream& is)
   {
     return read_cx_fp_value<float> (is);
   }
 
+  template <typename T>
+  void
+  write_value (std::ostream& os, const T& value)
+  {
+    os << value;
+  }
+
+  template void write_value<bool>  (std::ostream& os, const bool& value);
+  template void write_value<octave_int8> (std::ostream& os, const octave_int8& value);
+  template void write_value<octave_int16> (std::ostream& os, const octave_int16& value);
+  template void write_value<octave_int32> (std::ostream& os, const octave_int32& value);
+  template void write_value<octave_int64> (std::ostream& os, const octave_int64& value);
+  template void write_value<octave_uint8> (std::ostream& os, const octave_uint8& value);
+  template void write_value<octave_uint16> (std::ostream& os, const octave_uint16& value);
+  template void write_value<octave_uint32> (std::ostream& os, const octave_uint32& value);
+  template void write_value<octave_uint64> (std::ostream& os, const octave_uint64& value);
+
   // Note: precision is supposed to be managed outside of this function by
   // setting stream parameters.
 
-  template <> void write_value (std::ostream& os, const double& value)
+  template <> OCTAVE_API void write_value (std::ostream& os, const double& value)
   {
     if (lo_ieee_is_NA (value))
       os << "NA";
@@ -393,7 +430,7 @@
       os << value;
   }
 
-  template <> void write_value (std::ostream& os, const Complex& value)
+  template <> OCTAVE_API void write_value (std::ostream& os, const Complex& value)
   {
     os << '(';
     write_value<double> (os, real (value));
@@ -405,7 +442,7 @@
   // Note: precision is supposed to be managed outside of this function by
   // setting stream parameters.
 
-  template <> void write_value (std::ostream& os, const float& value)
+  template <> OCTAVE_API void write_value (std::ostream& os, const float& value)
   {
     if (lo_ieee_is_NA (value))
       os << "NA";
@@ -417,7 +454,7 @@
       os << value;
   }
 
-  template <> void write_value (std::ostream& os, const FloatComplex& value)
+  template <> OCTAVE_API void write_value (std::ostream& os, const FloatComplex& value)
   {
     os << '(';
     write_value<float> (os, real (value));
--- a/liboctave/util/lo-utils.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/lo-utils.h	Tue Dec 29 17:58:57 2020 +0100
@@ -98,44 +98,40 @@
 
 namespace octave
 {
-  template <typename T>
-  T
-  read_value (std::istream& is)
-  {
-    T retval;
-    is >> retval;
-    return retval;
-  }
+  template <typename T> OCTAVE_API T read_value (std::istream& is);
+
+  template <> OCTAVE_API double read_value (std::istream& is);
+  template <> OCTAVE_API Complex read_value (std::istream& is);
+  template <> OCTAVE_API float read_value (std::istream& is);
+  template <> OCTAVE_API FloatComplex read_value (std::istream& is);
 
-  template <> double read_value (std::istream& is);
-  template <> Complex read_value (std::istream& is);
-  template <> float read_value (std::istream& is);
-  template <> FloatComplex read_value (std::istream& is);
+  template <typename T> OCTAVE_API void write_value (std::ostream& os, const T& value);
 
-  template <typename T>
-  void
-  write_value (std::ostream& os, const T& value)
-  {
-    os << value;
-  }
-
-  template <> void write_value (std::ostream& os, const double& value);
-  template <> void write_value (std::ostream& os, const Complex& value);
-  template <> void write_value (std::ostream& os, const float& value);
-  template <> void write_value (std::ostream& os, const FloatComplex& value);
+  template <> OCTAVE_API void write_value (std::ostream& os, const double& value);
+  template <> OCTAVE_API void write_value (std::ostream& os, const Complex& value);
+  template <> OCTAVE_API void write_value (std::ostream& os, const float& value);
+  template <> OCTAVE_API void write_value (std::ostream& os, const FloatComplex& value);
 
   namespace math
   {
-    bool int_multiply_overflow (int a, int b);
-    bool int_multiply_overflow (long int a, long int b);
+    extern OCTAVE_API bool int_multiply_overflow (int a, int b);
+
+    extern OCTAVE_API bool int_multiply_overflow (long int a, long int b);
+
 #if defined (OCTAVE_HAVE_LONG_LONG_INT)
-    bool int_multiply_overflow (long long int a, long long int b);
+    extern OCTAVE_API bool
+    int_multiply_overflow (long long int a, long long int b);
 #endif
-    bool int_multiply_overflow (unsigned int a, unsigned int b);
-    bool int_multiply_overflow (unsigned long int a, unsigned long int b);
+
+    extern OCTAVE_API bool
+    int_multiply_overflow (unsigned int a, unsigned int b);
+
+    extern OCTAVE_API bool
+    int_multiply_overflow (unsigned long int a, unsigned long int b);
+
 #if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT)
-    bool int_multiply_overflow (unsigned long long int a,
-                                unsigned long long int b);
+    extern OCTAVE_API bool
+    int_multiply_overflow (unsigned long long int a, unsigned long long int b);
 #endif
   }
 }
--- a/liboctave/util/oct-atomic.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-atomic.h	Tue Dec 29 17:58:57 2020 +0100
@@ -32,9 +32,11 @@
 extern "C" {
 #endif
 
-  extern octave_idx_type octave_atomic_increment (octave_idx_type *x);
+  extern OCTAVE_API octave_idx_type
+  octave_atomic_increment (octave_idx_type *x);
 
-  extern octave_idx_type octave_atomic_decrement (octave_idx_type *x);
+  extern OCTAVE_API octave_idx_type
+  octave_atomic_decrement (octave_idx_type *x);
 
 #if defined __cplusplus
 }
--- a/liboctave/util/oct-glob.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-glob.h	Tue Dec 29 17:58:57 2020 +0100
@@ -34,14 +34,14 @@
 {
   namespace sys
   {
-    extern bool
+    extern OCTAVE_API bool
     fnmatch (const string_vector& pat, const std::string& str,
              int fnmatch_flags);
 
-    extern string_vector
+    extern OCTAVE_API string_vector
     glob (const string_vector&);
 
-    extern string_vector
+    extern OCTAVE_API string_vector
     windows_glob (const string_vector&);
   }
 }
--- a/liboctave/util/oct-inttypes.cc	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-inttypes.cc	Tue Dec 29 17:58:57 2020 +0100
@@ -793,7 +793,7 @@
 }
 
 #define INSTANTIATE_INTTYPE(T)                                          \
-  template class OCTAVE_API octave_int<T>;                              \
+  template class octave_int<T>;                                         \
                                                                         \
   template OCTAVE_API octave_int<T>                                     \
   pow (const octave_int<T>&, const octave_int<T>&);                     \
--- a/liboctave/util/oct-inttypes.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-inttypes.h	Tue Dec 29 17:58:57 2020 +0100
@@ -427,7 +427,7 @@
   // Convert a real number (check NaN and non-int).
 
   template <typename S>
-  static T convert_real (const S& value);
+  static OCTAVE_API T convert_real (const S& value);
 };
 
 // Saturated (homogeneous) integer arithmetics.  The signed and
@@ -791,6 +791,7 @@
 
 template <typename T>
 class
+OCTAVE_API
 octave_int : public octave_int_base<T>
 {
 public:
@@ -906,7 +907,7 @@
 
   static int byte_size (void) { return sizeof (T); }
 
-  static const char * type_name ();
+  static const OCTAVE_API char * type_name ();
 
   // The following are provided for convenience.
   static const octave_int zero, one;
--- a/liboctave/util/oct-shlib.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-shlib.h	Tue Dec 29 17:58:57 2020 +0100
@@ -39,7 +39,6 @@
 namespace octave
 {
   class
-  OCTAVE_API
   dynamic_library
   {
   public: // FIXME: make this class private?
@@ -57,6 +56,7 @@
 
     protected:
 
+      OCTAVE_API
       dynlib_rep (const std::string& f);
 
     public:
@@ -73,12 +73,12 @@
                              const name_mangler& = name_mangler ())
       { return nullptr; }
 
-      bool is_out_of_date (void) const;
+      OCTAVE_API bool is_out_of_date (void) const;
 
       // This method will be overridden conditionally.
-      static dynlib_rep * new_instance (const std::string& f);
+      static OCTAVE_API dynlib_rep * new_instance (const std::string& f);
 
-      static dynlib_rep * get_instance (const std::string& f, bool fake);
+      static OCTAVE_API dynlib_rep * get_instance (const std::string& f, bool fake);
 
       sys::time time_loaded (void) const
       { return m_time_loaded; }
@@ -88,11 +88,11 @@
 
       size_t num_fcn_names (void) const { return m_fcn_names.size (); }
 
-      std::list<std::string> function_names (void) const;
+      OCTAVE_API std::list<std::string> function_names (void) const;
 
-      void add_fcn_name (const std::string&);
+      OCTAVE_API void add_fcn_name (const std::string&);
 
-      bool remove_fcn_name (const std::string&);
+      OCTAVE_API bool remove_fcn_name (const std::string&);
 
       void clear_fcn_names (void) { m_fcn_names.clear (); }
 
@@ -102,9 +102,9 @@
 
     protected:
 
-      void fake_reload (void);
+      OCTAVE_API void fake_reload (void);
 
-      static std::map<std::string, dynlib_rep *> s_instances;
+      static OCTAVE_API std::map<std::string, dynlib_rep *> s_instances;
 
       // Set of hooked function names.
       typedef std::map<std::string, size_t>::iterator fcn_names_iterator;
@@ -118,7 +118,7 @@
 
   private:
 
-    static dynlib_rep s_nil_rep;
+    static OCTAVE_API dynlib_rep s_nil_rep;
 
   public:
 
--- a/liboctave/util/oct-sparse.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-sparse.h	Tue Dec 29 17:58:57 2020 +0100
@@ -171,16 +171,16 @@
   typedef int suitesparse_integer;
 #  endif
 
-  extern suitesparse_integer *
+  extern OCTAVE_API suitesparse_integer *
   to_suitesparse_intptr (octave_idx_type *i);
 
-  extern const suitesparse_integer *
+  extern OCTAVE_API const suitesparse_integer *
   to_suitesparse_intptr (const octave_idx_type *i);
 
-  extern octave_idx_type*
+  extern OCTAVE_API octave_idx_type*
   to_octave_idx_type_ptr (suitesparse_integer *i);
 
-  extern const octave_idx_type*
+  extern OCTAVE_API const octave_idx_type*
   to_octave_idx_type_ptr (const suitesparse_integer *i);
 }
 
--- a/liboctave/util/oct-string.cc	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-string.cc	Tue Dec 29 17:58:57 2020 +0100
@@ -210,28 +210,30 @@
 
 
 // Instantiations we need
-#define INSTANTIATE_OCTAVE_STRING(T)                                          \
-  template bool octave::string::strcmp<T> (const T&, const T&);               \
-  template bool octave::string::strcmp<T> (const T&,                          \
-                                           const typename T::value_type*);    \
-  template bool octave::string::strcmpi<T> (const T&, const T&);              \
-  template bool octave::string::strcmpi<T> (const T&,                         \
-                                            const typename T::value_type*);   \
-  template bool octave::string::strncmp<T> (const T&, const T&,               \
-                                            const typename T::size_type);     \
-  template bool octave::string::strncmp<T> (const T&,                         \
-                                            const typename T::value_type*,    \
-                                            const typename T::size_type);     \
-  template bool octave::string::strncmpi<T> (const T&, const T&,              \
-                                             const typename T::size_type n);  \
-  template bool octave::string::strncmpi<T> (const T&,                        \
-                                             const typename T::value_type*,   \
-                                             const typename T::size_type);
+#define INSTANTIATE_OCTAVE_STRING(T, API)                                     \
+  template API bool octave::string::strcmp<T> (const T&, const T&);           \
+  template API bool                                                           \
+  octave::string::strcmp<T> (const T&, const typename T::value_type*);        \
+  template API bool octave::string::strcmpi<T> (const T&, const T&);          \
+  template API bool                                                           \
+  octave::string::strcmpi<T> (const T&, const typename T::value_type*);       \
+  template API bool                                                           \
+  octave::string::strncmp<T> (const T&, const T&,                             \
+                              const typename T::size_type);                   \
+  template API bool                                                           \
+  octave::string::strncmp<T> (const T&, const typename T::value_type*,        \
+                              const typename T::size_type);                   \
+  template API bool                                                           \
+  octave::string::strncmpi<T> (const T&, const T&,                            \
+                               const typename T::size_type n);                \
+  template API bool                                                           \
+  octave::string::strncmpi<T> (const T&, const typename T::value_type*,       \
+                               const typename T::size_type);
 
 // We could also instantiate std::vector<char> but would it be
 // useful for anyone?
-INSTANTIATE_OCTAVE_STRING(std::string)
-INSTANTIATE_OCTAVE_STRING(Array<char>)
+INSTANTIATE_OCTAVE_STRING(std::string, OCTAVE_API)
+INSTANTIATE_OCTAVE_STRING(Array<char>, OCTAVE_API)
 
 #undef INSTANTIATE_OCTAVE_STRING
 
@@ -709,5 +711,5 @@
 }
 
 // instantiate the template for float and double
-template std::string rational_approx <float> (float val, int len);
-template std::string rational_approx <double> (double val, int len);
+template OCTAVE_API std::string rational_approx <float> (float val, int len);
+template OCTAVE_API std::string rational_approx <double> (double val, int len);
--- a/liboctave/util/oct-string.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/oct-string.h	Tue Dec 29 17:58:57 2020 +0100
@@ -57,7 +57,8 @@
     //! char array, will still return false.
 
     template <typename T>
-    bool strcmp (const T& str_a, const T& str_b);
+    OCTAVE_API bool
+    strcmp (const T& str_a, const T& str_b);
 
     //! True if string is the same as character sequence.
     //!
@@ -70,7 +71,8 @@
     //! is considered to be a row vector.
 
     template <typename T>
-    bool strcmp (const T& str_a, const typename T::value_type *str_b);
+    OCTAVE_API bool
+    strcmp (const T& str_a, const typename T::value_type *str_b);
 
     //! True if strings are the same, ignoring case.
     //!
@@ -81,7 +83,8 @@
     //! char array, will still return false.
 
     template <typename T>
-    bool strcmpi (const T& str_a, const T& str_b);
+    OCTAVE_API bool
+    strcmpi (const T& str_a, const T& str_b);
 
     //! True if string is the same as character sequence, ignoring case.
     //!
@@ -91,7 +94,8 @@
     //! is considered to be a row vector.
 
     template <typename T>
-    bool strcmpi (const T& str_a, const typename T::value_type *str_b);
+    OCTAVE_API bool
+    strcmpi (const T& str_a, const typename T::value_type *str_b);
 
     //! True if the first N characters are the same.
     //!
@@ -102,13 +106,15 @@
     //! a column vector of the same still return true.
 
     template <typename T>
-    bool strncmp (const T& str_a, const T& str_b,
-                  const typename T::size_type n);
+    OCTAVE_API bool
+    strncmp (const T& str_a, const T& str_b,
+             const typename T::size_type n);
 
     //! True if the first N characters are the same.
     template <typename T>
-    bool strncmp (const T& str_a, const typename T::value_type *str_b,
-                  const typename T::size_type n);
+    OCTAVE_API bool
+    strncmp (const T& str_a, const typename T::value_type *str_b,
+             const typename T::size_type n);
 
     //! True if the first N characters are the same, ignoring case.
     //!
@@ -119,13 +125,15 @@
     //! a column vector of the same still return true.
 
     template <typename T>
-    bool strncmpi (const T& str_a, const T& str_b,
-                   const typename T::size_type n);
+    OCTAVE_API bool
+    strncmpi (const T& str_a, const T& str_b,
+              const typename T::size_type n);
 
     //! True if the first N characters are the same, ignoring case.
     template <typename T>
-    bool strncmpi (const T& str_a, const typename T::value_type *str_b,
-                   const typename T::size_type n);
+    OCTAVE_API bool
+    strncmpi (const T& str_a, const typename T::value_type *str_b,
+              const typename T::size_type n);
 
     extern OCTAVE_API Complex
     str2double (const std::string& str_arg);
--- a/liboctave/util/quit.h	Tue Dec 29 17:53:59 2020 +0100
+++ b/liboctave/util/quit.h	Tue Dec 29 17:58:57 2020 +0100
@@ -89,7 +89,7 @@
             && a.column () == b.column ());
   }
 
-  class execution_exception : public std::runtime_error
+  class OCTAVE_API execution_exception : public std::runtime_error
   {
   public:
 
@@ -222,26 +222,26 @@
     0: no interrupt pending
   < 0: handling interrupt
 */
-OCTAVE_API extern sig_atomic_t octave_interrupt_state;
+extern OCTAVE_API sig_atomic_t octave_interrupt_state;
 
 OCTAVE_DEPRECATED (6, "'octave_exception_state' is an obsolete internal variable; any uses should be removed")
-OCTAVE_API extern sig_atomic_t octave_exception_state;
+extern OCTAVE_API sig_atomic_t octave_exception_state;
 
-OCTAVE_API extern volatile sig_atomic_t octave_signal_caught;
+extern OCTAVE_API volatile sig_atomic_t octave_signal_caught;
 
-OCTAVE_API extern void octave_handle_signal (void);
+extern OCTAVE_API void octave_handle_signal (void);
 
 OCTAVE_DEPRECATED (6, "use 'throw octave::interrupt_exception' instead")
-OCTAVE_NORETURN OCTAVE_API extern void octave_throw_interrupt_exception (void);
+OCTAVE_NORETURN extern OCTAVE_API void octave_throw_interrupt_exception (void);
 
 OCTAVE_DEPRECATED (6, "use 'throw octave::execution_exception' instead")
-OCTAVE_NORETURN OCTAVE_API extern void octave_throw_execution_exception (void);
+OCTAVE_NORETURN extern OCTAVE_API void octave_throw_execution_exception (void);
 
 OCTAVE_DEPRECATED (6, "use 'throw std::bad_alloc' instead")
-OCTAVE_NORETURN OCTAVE_API extern void octave_throw_bad_alloc (void);
+OCTAVE_NORETURN extern OCTAVE_API void octave_throw_bad_alloc (void);
 
 OCTAVE_DEPRECATED (6, "use 'throw' instead")
-OCTAVE_API extern void octave_rethrow_exception (void);
+extern OCTAVE_API void octave_rethrow_exception (void);
 
 #if defined (__cplusplus)