GNU Octave  4.4.1
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-2018 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_dynamic_ld_h)
24 #define octave_dynamic_ld_h 1
25 
26 #include "octave-config.h"
27 
28 #include <list>
29 #include <string>
30 
31 #include "oct-shlib.h"
32 
33 class octave_function;
34 
35 namespace octave
36 {
37  class interpreter;
38 
39  class
41  {
42  private:
43 
44  class
46  {
47  public:
48 
49  typedef std::list<dynamic_library>::iterator iterator;
50  typedef std::list<dynamic_library>::const_iterator const_iterator;
51 
52  shlibs_list (void) : m_lib_list () { }
53 
54  // No copying!
55 
56  shlibs_list (const shlibs_list&) = delete;
57 
58  shlibs_list& operator = (const shlibs_list&) = delete;
59 
60  ~shlibs_list (void) = default;
61 
62  void append (const dynamic_library& shl);
63 
64  std::list<std::string> remove (dynamic_library& shl);
65 
66  dynamic_library find_file (const std::string& file_name) const;
67 
68  void display (void) const;
69 
70  private:
71 
72  // List of libraries we have loaded.
73  std::list<dynamic_library> m_lib_list;
74  };
75 
76 
77  public:
78 
80  : m_interpreter (interp), m_loaded_shlibs (), m_doing_load (false)
81  { }
82 
83  // No copying!
84 
85  dynamic_loader (const dynamic_loader&) = delete;
86 
87  dynamic_loader& operator = (const dynamic_loader&) = delete;
88 
89  virtual ~dynamic_loader (void) = default;
90 
92  load_oct (const std::string& fcn_name,
93  const std::string& file_name = "",
94  bool relative = false);
95 
97  load_mex (const std::string& fcn_name,
98  const std::string& file_name = "",
99  bool relative = false);
100 
101  bool remove_oct (const std::string& fcn_name,
102  dynamic_library& shl);
103 
104  bool remove_mex (const std::string& fcn_name,
105  dynamic_library& shl);
106 
107  private:
108 
109  void clear_function (const std::string& fcn_name);
110 
111  void clear (dynamic_library& oct_file);
112 
114 
116 
118 
119  static std::string name_mangler (const std::string& name);
120 
121  static std::string name_uscore_mangler (const std::string& name);
122 
123  static std::string mex_mangler (const std::string& name);
124 
125  static std::string mex_uscore_mangler (const std::string& name);
126 
127  static std::string mex_f77_mangler (const std::string& name);
128  };
129 }
130 
131 #endif
OCTINTERP_API void clear_function(const std::string &nm)
std::list< dynamic_library >::iterator iterator
Definition: dynamic-ld.h:49
std::list< dynamic_library > m_lib_list
Definition: dynamic-ld.h:73
nd deftypefn *std::string name
Definition: sysdep.cc:647
interpreter & m_interpreter
Definition: dynamic-ld.h:113
dynamic_loader(interpreter &interp)
Definition: dynamic-ld.h:79
shlibs_list m_loaded_shlibs
Definition: dynamic-ld.h:115
is false
Definition: cellfun.cc:400
bool append
Definition: load-save.cc:1618
std::list< dynamic_library >::const_iterator const_iterator
Definition: dynamic-ld.h:50
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888