Mercurial > octave
annotate libinterp/corefcn/dynamic-ld.h @ 28125:0a88a4743096
tag mex function as supporting interleaved complex (or not)
* dynamic-ld.cc (dynamic_loader::try_load_mex): New function.
(dynamic_loader::load_mex): Call it. Check mex file for
__mx_has_interleaved_complex__ symbol and pass flag to
octave_mex_function constructor.
* ov-mex-fcn.cc (octave_mex_function::m_interleaved): New data member.
(octave_mex_function::octave_mex_function):
New arg, interleaved.
(octave_mex_function::use_interleaved_complex): New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 18 Feb 2020 12:50:18 -0500 |
parents | bd51beb6205e |
children | 7854d5752dd2 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 // Copyright (C) 1993-2020 The Octave Project Developers |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
1 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 #if ! defined (octave_dynamic_ld_h) |
383 | 27 #define octave_dynamic_ld_h 1 |
1 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
30 |
22999
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
31 #include <list> |
2862 | 32 #include <string> |
33 | |
3325 | 34 #include "oct-shlib.h" |
2894 | 35 |
7336 | 36 class octave_function; |
37 | |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
38 namespace octave |
2894 | 39 { |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
40 class interpreter; |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
41 |
22999
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
42 class |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
43 dynamic_loader |
22999
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
44 { |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
45 private: |
2894 | 46 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
47 class |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
48 shlibs_list |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
49 { |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
50 public: |
2894 | 51 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23627
diff
changeset
|
52 typedef std::list<dynamic_library>::iterator iterator; |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23627
diff
changeset
|
53 typedef std::list<dynamic_library>::const_iterator const_iterator; |
2894 | 54 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
55 shlibs_list (void) : m_lib_list () { } |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
56 |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
57 // No copying! |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
58 |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
59 shlibs_list (const shlibs_list&) = delete; |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
60 |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
61 shlibs_list& operator = (const shlibs_list&) = delete; |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
62 |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
63 ~shlibs_list (void) = default; |
1 | 64 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23627
diff
changeset
|
65 void append (const dynamic_library& shl); |
22999
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
66 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23627
diff
changeset
|
67 std::list<std::string> remove (dynamic_library& shl); |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
68 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23627
diff
changeset
|
69 dynamic_library find_file (const std::string& file_name) const; |
5864 | 70 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
71 void display (void) const; |
22999
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
72 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
73 private: |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
74 |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
75 // List of libraries we have loaded. |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23627
diff
changeset
|
76 std::list<dynamic_library> m_lib_list; |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
77 }; |
7872 | 78 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
79 |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
80 public: |
2894 | 81 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
82 dynamic_loader (interpreter& interp) |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
83 : m_interpreter (interp), m_loaded_shlibs (), m_doing_load (false) |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
84 { } |
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
85 |
22999
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
86 // No copying! |
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
87 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
88 dynamic_loader (const dynamic_loader&) = delete; |
2894 | 89 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
90 dynamic_loader& operator = (const dynamic_loader&) = delete; |
2894 | 91 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
92 virtual ~dynamic_loader (void) = default; |
2926 | 93 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
94 octave_function * |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
95 load_oct (const std::string& fcn_name, |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
96 const std::string& file_name = "", |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
97 bool relative = false); |
2926 | 98 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
99 octave_function * |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
100 load_mex (const std::string& fcn_name, |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
101 const std::string& file_name = "", |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
102 bool relative = false); |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
103 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
104 bool remove_oct (const std::string& fcn_name, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
105 dynamic_library& shl); |
2926 | 106 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
107 bool remove_mex (const std::string& fcn_name, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
108 dynamic_library& shl); |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
109 |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
110 private: |
5864 | 111 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
112 void clear_function (const std::string& fcn_name); |
7872 | 113 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23627
diff
changeset
|
114 void clear (dynamic_library& oct_file); |
3325 | 115 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
116 interpreter& m_interpreter; |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
117 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
118 shlibs_list m_loaded_shlibs; |
2926 | 119 |
23627
0a6e87804cab
don't use singleton pattern for dynamic_loader class
John W. Eaton <jwe@octave.org>
parents:
23554
diff
changeset
|
120 bool m_doing_load; |
7336 | 121 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
122 static std::string name_mangler (const std::string& name); |
22999
f4781639f847
convert octave_shlib_list from singleton to ordinary object
John W. Eaton <jwe@octave.org>
parents:
22869
diff
changeset
|
123 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
124 static std::string name_uscore_mangler (const std::string& name); |
7872 | 125 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
126 static std::string mex_mangler (const std::string& name); |
7872 | 127 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
128 static std::string mex_uscore_mangler (const std::string& name); |
7872 | 129 |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
130 static std::string mex_f77_mangler (const std::string& name); |
28125
0a88a4743096
tag mex function as supporting interleaved complex (or not)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
131 |
0a88a4743096
tag mex function as supporting interleaved complex (or not)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
132 static void * try_load_mex (dynamic_library& mex_file, |
0a88a4743096
tag mex function as supporting interleaved complex (or not)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
133 const std::string& fcn_name, bool& have_fmex); |
23000
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
134 }; |
f981282a3bd0
move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents:
22999
diff
changeset
|
135 } |
1 | 136 |
137 #endif |