diff libinterp/corefcn/dynamic-ld.cc @ 23599:5cb3a2bb5e1e

don't use singleton for symbol_table This is the first of a series of changes to make the symbol table a part of the interpreter instead of a global object. These changes also aim to simplify the implementation of symbol table so that it is easier to understand and modify. * Functions now own their scope (workspace) data. * The list of subfunctions is contained in the scope rather than a global list. * symtab.h, symtab.cc (class symbol_table): Don't use singleton pattern. * interpreter.h, interpreter.cc (interpreter::m_symbol_table): New data member. (interpreter::~interpreter): Don't set instance to 0. * interpreter-private.h, interpreter-private.cc (__get_symbol_table__): New function. Change all uses of call_stack to access call_stack object from the interpreter.
author John W. Eaton <jwe@octave.org>
date Fri, 09 Jun 2017 02:21:28 -0400
parents b075b1629c26
children 0a6e87804cab
line wrap: on
line diff
--- a/libinterp/corefcn/dynamic-ld.cc	Fri Jun 09 11:36:34 2017 -0400
+++ b/libinterp/corefcn/dynamic-ld.cc	Fri Jun 09 02:21:28 2017 -0400
@@ -35,6 +35,7 @@
 #include "defaults.h"
 #include "defun.h"
 #include "dynamic-ld.h"
+#include "interpreter-private.h"
 #include "ov-fcn.h"
 #include "ov-dld-fcn.h"
 #include "ov-mex-fcn.h"
@@ -127,7 +128,10 @@
   {
     warning_with_id ("Octave:reload-forces-clear", "  %s", fcn_name.c_str ());
 
-    symbol_table::clear_dld_function (fcn_name);
+    symbol_table& symtab
+      = __get_symbol_table__ ("dynamic_loader::do_clear_function");
+
+    symtab.clear_dld_function (fcn_name);
   }
 
   void
@@ -148,8 +152,11 @@
       {
         std::list<std::string> removed_fcns = loaded_shlibs.remove (oct_file);
 
+        symbol_table& symtab
+          = __get_symbol_table__ ("dynamic_loader::do_clear");
+
         for (const auto& fcn_name : removed_fcns)
-          symbol_table::clear_dld_function (fcn_name);
+          symtab.clear_dld_function (fcn_name);
       }
   }