GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dynamic-ld.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_dynamic_ld_h)
27 #define octave_dynamic_ld_h 1
28 
29 #include "octave-config.h"
30 
31 #include <list>
32 #include <string>
33 
34 #include "oct-shlib.h"
35 
36 class octave_function;
37 
39 
40 class interpreter;
41 
42 class
44 {
45 private:
46 
47  class
49  {
50  public:
51 
52  typedef std::list<dynamic_library>::iterator iterator;
53  typedef std::list<dynamic_library>::const_iterator const_iterator;
54 
55  shlibs_list (void) : m_lib_list () { }
56 
57  // No copying!
58 
59  shlibs_list (const shlibs_list&) = delete;
60 
61  shlibs_list& operator = (const shlibs_list&) = delete;
62 
63  ~shlibs_list (void) = default;
64 
65  void append (const dynamic_library& shl);
66 
67  std::list<std::string> remove (dynamic_library& shl);
68 
69  dynamic_library find_file (const std::string& file_name) const;
70 
71  void display (void) const;
72 
73  private:
74 
75  // List of libraries we have loaded.
76  std::list<dynamic_library> m_lib_list;
77  };
78 
79 
80 public:
81 
83  : m_interpreter (interp), m_loaded_shlibs (), m_doing_load (false)
84  { }
85 
86  // No copying!
87 
88  dynamic_loader (const dynamic_loader&) = delete;
89 
91 
92  virtual ~dynamic_loader (void) = default;
93 
95  load_oct (const std::string& fcn_name,
96  const std::string& file_name = "",
97  bool relative = false);
98 
100  load_mex (const std::string& fcn_name,
101  const std::string& file_name = "",
102  bool relative = false);
103 
104  bool remove_oct (const std::string& fcn_name,
105  dynamic_library& shl);
106 
107  bool remove_mex (const std::string& fcn_name,
108  dynamic_library& shl);
109 
110 private:
111 
112  void clear_function (const std::string& fcn_name);
113 
114  void clear (dynamic_library& oct_file);
115 
117 
119 
121 
122  static std::string name_mangler (const std::string& name);
123 
124  static std::string name_uscore_mangler (const std::string& name);
125 
126  static std::string mex_mangler (const std::string& name);
127 
128  static std::string mex_uscore_mangler (const std::string& name);
129 
130  static std::string mex_f77_mangler (const std::string& name);
131 
132  static void * try_load_mex (dynamic_library& mex_file,
133  const std::string& fcn_name, bool& have_fmex);
134 };
135 
137 
138 #endif
OCTAVE_END_NAMESPACE(octave)
std::list< dynamic_library >::iterator iterator
Definition: dynamic-ld.h:52
std::list< dynamic_library > m_lib_list
Definition: dynamic-ld.h:76
std::list< dynamic_library >::const_iterator const_iterator
Definition: dynamic-ld.h:53
shlibs_list(const shlibs_list &)=delete
interpreter & m_interpreter
Definition: dynamic-ld.h:116
virtual ~dynamic_loader(void)=default
dynamic_loader(interpreter &interp)
Definition: dynamic-ld.h:82
shlibs_list m_loaded_shlibs
Definition: dynamic-ld.h:118
dynamic_loader(const dynamic_loader &)=delete
void clear_function(const std::string &name)
interpreter & operator=(const interpreter &)=delete
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn