Mercurial > octave
diff liboctave/util/oct-shlib.h @ 23554:b075b1629c26
don't use hook function in dynamic_library::dynlib_rep::close function
* oct-shlib.h, oct-shlib.cc
(dynamic_library::dynlib_rep::function_names): New function.
(dynamic_library::dynlib_rep::clear_fcn_names)): New function.
(dynamic_library::dynlib_rep::do_close_hook): Delete.
(dynamic_library::close): Return list of function names instead of
calling close_hook function on each function name.
* dynamic-ld.h, dynamic-ld.cc (dynamic_loader::shlibs_list::remove):
Return list of removed functions instead of passing close_hook
function to the shared-library close function.
(dynamic_loader::do_clear): Clear functions removed from dynamically
loaded library here.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 02 Jun 2017 09:16:02 -0400 |
parents | cd4e1ee28716 |
children | be7b884ac589 |
line wrap: on
line diff
--- a/liboctave/util/oct-shlib.h Wed Jun 07 02:13:05 2017 -0400 +++ b/liboctave/util/oct-shlib.h Fri Jun 02 09:16:02 2017 -0400 @@ -26,6 +26,7 @@ #include "octave-config.h" +#include <list> #include <string> #include <map> @@ -41,7 +42,6 @@ public: // FIXME: make this class private? typedef std::string (*name_mangler) (const std::string&); - typedef void (*close_hook) (const std::string&); class dynlib_rep { @@ -82,11 +82,13 @@ size_t num_fcn_names (void) const { return fcn_names.size (); } + std::list<std::string> function_names (void) const; + void add_fcn_name (const std::string&); bool remove_fcn_name (const std::string&); - void do_close_hook (close_hook cl_hook); + void clear_fcn_names (void) { fcn_names.clear (); } public: @@ -153,12 +155,15 @@ void open (const std::string& f) { *this = dynamic_library (f); } - void close (close_hook cl_hook = 0) + std::list<std::string> close (void) { - if (cl_hook) - rep->do_close_hook (cl_hook); + std::list<std::string> removed_fcns = rep->function_names (); + + rep->clear_fcn_names (); *this = dynamic_library (); + + return removed_fcns; } void * search (const std::string& nm, name_mangler mangler = 0) const