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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
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
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 240
diff changeset
27 #define octave_dynamic_ld_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
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
95e85daad148 [project @ 1997-04-15 22:00:57 by jwe]
jwe
parents: 2847
diff changeset
32 #include <string>
95e85daad148 [project @ 1997-04-15 22:00:57 by jwe]
jwe
parents: 2847
diff changeset
33
3325
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 2970
diff changeset
34 #include "oct-shlib.h"
2894
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
35
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
36 class octave_function;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
37
23000
f981282a3bd0 move octave_dynamic_loader into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22999
diff changeset
38 namespace octave
2894
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
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
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
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
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
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
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
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
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
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
e884ab4f29ee [project @ 2006-06-22 00:57:27 by jwe]
jwe
parents: 5307
diff changeset
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
1b63f8da772d fix unloading of mex files
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
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
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
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
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
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
f1c5f8151397 [project @ 1997-04-28 05:39:26 by jwe]
jwe
parents: 2893
diff changeset
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
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2894
diff changeset
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
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2894
diff changeset
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
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2894
diff changeset
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
e884ab4f29ee [project @ 2006-06-22 00:57:27 by jwe]
jwe
parents: 5307
diff changeset
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
1b63f8da772d fix unloading of mex files
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
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
2efa28a91e7a [project @ 1999-10-29 21:39:20 by jwe]
jwe
parents: 2970
diff changeset
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
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2894
diff changeset
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
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
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
1b63f8da772d fix unloading of mex files
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
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
1b63f8da772d fix unloading of mex files
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
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
1b63f8da772d fix unloading of mex files
John W. Eaton <jwe@octave.org>
parents: 7336
diff changeset
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
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
136
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
137 #endif