26 #if defined (HAVE_CONFIG_H)
49 #define STRINGIFY(s) STRINGIFY1(s)
50 #define STRINGIFY1(s) #s
57 m_lib_list.push_back (shl);
60 std::list<std::string>
63 std::list<std::string> removed_fcns;
65 for (
auto p = m_lib_list.begin (); p != m_lib_list.end (); p++)
71 removed_fcns = shl.
close ();
81 dynamic_loader::shlibs_list::find_file (
const std::string& file_name)
const
85 for (
const auto& lib : m_lib_list)
87 if (lib.file_name () == file_name)
98 dynamic_loader::shlibs_list::display ()
const
100 std::cerr <<
"current shared libraries:" << std::endl;
101 for (
const auto& lib : m_lib_list)
102 std::cerr <<
" " << lib.
file_name () << std::endl;
106 dynamic_loader::clear_function (
const std::string& fcn_name)
108 warning_with_id (
"Octave:reload-forces-clear",
" %s", fcn_name.c_str ());
125 "reloading %s clears the following functions:",
128 std::list<std::string> removed_fcns = m_loaded_shlibs.remove (oct_file);
130 for (
const auto& fcn_name : removed_fcns)
131 clear_function (fcn_name);
135 std::list<std::string> removed_fcns = m_loaded_shlibs.remove (oct_file);
143 for (
const auto& fcn_name : removed_fcns)
150 const std::string& file_name,
164 oct_file.
open (file_name);
167 m_loaded_shlibs.append (oct_file);
171 error (
"%s is not a valid shared library", file_name.c_str ());
173 void *
function = oct_file.
search (fcn_name, name_mangler);
180 function = oct_file.
search (fcn_name, name_uscore_mangler);
188 retval =
f (oct_file, relative);
191 error (
"failed to install .oct file function '%s'",
200 const std::string& fcn_name,
bool& have_fmex)
207 void *
function = mex_file.
search (fcn_name, mex_mangler);
214 function = mex_file.
search (fcn_name, mex_uscore_mangler);
218 function = mex_file.
search (fcn_name, mex_f77_mangler);
230 const std::string& file_name,
242 mex_file.
open (file_name);
245 m_loaded_shlibs.append (mex_file);
249 error (
"%s is not a valid shared library", file_name.c_str ());
251 bool have_fmex =
false;
253 void *
function = try_load_mex (mex_file, fcn_name, have_fmex);
256 error (
"failed to install .mex file function '%s'", fcn_name.c_str ());
258 void *symbol = mex_file.
search (
"__mx_has_interleaved_complex__");
260 bool interleaved = symbol !=
nullptr;
277 retval = shl.
remove (fcn_name);
280 m_loaded_shlibs.remove (shl);
295 dynamic_loader::name_mangler (
const std::string& name)
301 dynamic_loader::name_uscore_mangler (
const std::string& name)
307 dynamic_loader::mex_mangler (
const std::string&)
309 return "mexFunction";
313 dynamic_loader::mex_uscore_mangler (
const std::string&)
315 return "_mexFunction";
319 dynamic_loader::mex_f77_mangler (
const std::string&)
324 OCTAVE_END_NAMESPACE(
octave)
void * search(const std::string &nm, const name_mangler &mangler=name_mangler()) const
void open(const std::string &f)
std::string file_name() const
std::list< std::string > close()
bool is_out_of_date() const
std::size_t number_of_functions_loaded() const
bool remove(const std::string &name)
bool remove_oct(const std::string &fcn_name, dynamic_library &shl)
bool remove_mex(const std::string &fcn_name, dynamic_library &shl)
octave_function * load_oct(const std::string &fcn_name, const std::string &file_name="", bool relative=false)
octave_function * load_mex(const std::string &fcn_name, const std::string &file_name="", bool relative=false)
symbol_table & get_symbol_table()
void clear_dld_function(const std::string &name)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave_function *(* octave_dld_fcn_getter)(const octave::dynamic_library &, bool relative)
void warning_with_id(const char *id, const char *fmt,...)
void() error(const char *fmt,...)
F77_RET_T const F77_DBLE const F77_DBLE * f
F77_RET_T F77_FUNC(xerbla, XERBLA)(F77_CONST_CHAR_ARG_DEF(s_arg