changeset 30750:b92316e295a2 stable

new class to help manage octave_value reps for dynamically loaded files * ov-base.h (octave_base_dld_value): New class.
author John W. Eaton <jwe@octave.org>
date Thu, 17 Feb 2022 22:24:37 -0500
parents 076e19eac74a
children 71ca1db02426
files libinterp/octave-value/ov-base.h
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.h	Thu Feb 17 22:21:03 2022 -0500
+++ b/libinterp/octave-value/ov-base.h	Thu Feb 17 22:24:37 2022 -0500
@@ -40,6 +40,7 @@
 #include "mx-base.h"
 #include "str-vec.h"
 
+#include "auto-shlib.h"
 #include "oct-hdf5-types.h"
 #include "oct-stream.h"
 
@@ -913,6 +914,28 @@
   DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA
 };
 
+class
+OCTINTERP_API
+octave_base_dld_value : public octave_base_value
+{
+public:
+
+  octave_base_dld_value (void) = default;
+
+  ~octave_base_dld_value (void)
+  {
+    m_containing_dynamic_library.delete_later ();
+  }
+
+  octave_base_dld_value (const octave_base_dld_value&) = default;
+
+  octave_base_dld_value& operator = (const octave_base_dld_value&) = default;
+
+private:
+
+  octave::auto_shlib m_containing_dynamic_library;
+};
+
 // TRUE means to perform automatic sparse to real mutation if there
 // is memory to be saved
 extern OCTINTERP_API bool Vsparse_auto_mutate;