GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
dynamic-ld.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2025 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
36class octave_function;
37
39
40class interpreter;
41
43{
44private:
45
46 class shlibs_list
47 {
48 public:
49
50 typedef std::list<dynamic_library>::iterator iterator;
51 typedef std::list<dynamic_library>::const_iterator const_iterator;
52
53 shlibs_list () : m_lib_list () { }
54
55 OCTAVE_DISABLE_COPY_MOVE (shlibs_list)
56
57 ~shlibs_list () = default;
58
59 void append (const dynamic_library& shl);
60
61 std::list<std::string> remove (dynamic_library& shl);
62
63 dynamic_library find_file (const std::string& file_name) const;
64
65 void display () const;
66
67 private:
68
69 // List of libraries we have loaded.
70 std::list<dynamic_library> m_lib_list;
71 };
72
73
74public:
75
76 dynamic_loader () = delete;
77
79 : m_interpreter (interp), m_loaded_shlibs (), m_doing_load (false)
80 { }
81
82 OCTAVE_DISABLE_COPY_MOVE (dynamic_loader)
83
84 virtual ~dynamic_loader () = default;
85
87 load_oct (const std::string& fcn_name,
88 const std::string& file_name = "",
89 bool relative = false);
90
92 load_mex (const std::string& fcn_name,
93 const std::string& file_name = "",
94 bool relative = false);
95
96 bool remove_oct (const std::string& fcn_name,
97 dynamic_library& shl);
98
99 bool remove_mex (const std::string& fcn_name,
100 dynamic_library& shl);
101
102private:
103
104 void clear_function (const std::string& fcn_name);
105
106 void clear (dynamic_library& oct_file);
107
108 interpreter& m_interpreter;
109
110 shlibs_list m_loaded_shlibs;
111
112 bool m_doing_load;
113
114 static std::string name_mangler (const std::string& name);
115
116 static std::string name_uscore_mangler (const std::string& name);
117
118 static std::string mex_mangler (const std::string& name);
119
120 static std::string mex_uscore_mangler (const std::string& name);
121
122 static std::string mex_f77_mangler (const std::string& name);
123
124 static void * try_load_mex (dynamic_library& mex_file,
125 const std::string& fcn_name, bool& have_fmex);
126};
127
128OCTAVE_END_NAMESPACE(octave)
129
130#endif
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)
dynamic_loader(interpreter &interp)
Definition dynamic-ld.h:78
octave_function * load_mex(const std::string &fcn_name, const std::string &file_name="", bool relative=false)
dynamic_loader()=delete
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn