Mercurial > octave
annotate liboctave/util/oct-shlib.cc @ 22323:bac0d6f07a3e
maint: Update copyright notices for 2016.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 17 Aug 2016 01:05:19 -0400 |
parents | c5842206aaea |
children | 4caa7b28d183 |
rev | line source |
---|---|
3326 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22157
diff
changeset
|
3 Copyright (C) 1999-2016 John W. Eaton |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
4 Copyright (C) 2009 VZLU Prague |
3326 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
3326 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
3326 | 21 |
22 */ | |
23 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21661
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21236
diff
changeset
|
25 # include "config.h" |
3326 | 26 #endif |
27 | |
7749
14e05160b99f
reference counting for functions loaded from shared libraries
John W. Eaton <jwe@octave.org>
parents:
7520
diff
changeset
|
28 #include <map> |
14e05160b99f
reference counting for functions loaded from shared libraries
John W. Eaton <jwe@octave.org>
parents:
7520
diff
changeset
|
29 |
4110 | 30 #if defined (HAVE_SHL_LOAD_API) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
31 # include <cerrno> |
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
32 # include <cstring> |
3326 | 33 #endif |
34 | |
4162 | 35 #if defined (HAVE_DYLD_API) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
36 # include <mach-o/dyld.h> |
4162 | 37 #endif |
38 | |
3326 | 39 extern "C" |
40 { | |
4110 | 41 #if defined (HAVE_DLOPEN_API) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
42 # if defined (HAVE_DLFCN_H) |
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
43 # include <dlfcn.h> |
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
44 # else |
3326 | 45 extern void *dlopen (const char *, int); |
46 extern const char *dlerror (void); | |
47 extern void *dlsym (void *, const char *); | |
48 extern int dlclose (void *); | |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
49 # endif |
4110 | 50 #elif defined (HAVE_SHL_LOAD_API) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
51 # include <dl.h> |
5451 | 52 #elif defined (HAVE_LOADLIBRARY_API) |
21213
f7d1050b9b53
maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
53 # define WIN32_LEAN_AND_MEAN 1 |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
54 # include <windows.h> |
3326 | 55 #endif |
56 } | |
57 | |
22146
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
58 #include "file-ops.h" |
3326 | 59 #include "file-stat.h" |
60 #include "lo-error.h" | |
61 #include "oct-shlib.h" | |
62 #include "str-vec.h" | |
63 | |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
64 namespace octave |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
65 { |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
66 dynamic_library::dynlib_rep::dynlib_rep (const std::string& f) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
67 : count (1), file (f), tm_loaded (), fcn_names () |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
68 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
69 instances[f] = this; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
70 |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
71 if (is_out_of_date ()) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
72 (*current_liboctave_warning_with_id_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
73 ("Octave:warn-future-time-stamp", |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
74 "timestamp on file %s is in the future", file.c_str ()); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
75 } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
76 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
77 bool |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
78 dynamic_library::dynlib_rep::is_out_of_date (void) const |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
79 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
80 octave::sys::file_stat fs (file); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
81 return (fs && fs.is_newer (tm_loaded)); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
82 } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
83 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
84 void |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
85 dynamic_library::dynlib_rep::fake_reload (void) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
86 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
87 // We can't actually reload the library, but we'll pretend we did. |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
88 octave::sys::file_stat fs (file); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
89 if (fs && fs.is_newer (tm_loaded)) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
90 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
91 tm_loaded = fs.mtime (); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
92 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
93 (*current_liboctave_warning_with_id_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
94 ("Octave:library-reload", |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
95 "library %s not reloaded due to existing references", file.c_str ()); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
96 } |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
97 } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
98 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
99 dynamic_library::dynlib_rep * |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
100 dynamic_library::dynlib_rep::get_instance (const std::string& f, bool fake) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
101 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
102 dynlib_rep *retval = 0; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
103 std::map<std::string, dynlib_rep *>::iterator p = instances.find (f); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
104 if (p != instances.end ()) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
105 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
106 retval = p->second; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
107 retval->count++; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
108 if (fake) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
109 retval->fake_reload (); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
110 } |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
111 else |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
112 retval = new_instance (f); |
3326 | 113 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
114 return retval; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
115 } |
3326 | 116 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
117 void |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
118 dynamic_library::dynlib_rep::add_fcn_name (const std::string& name) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
119 { |
21862
5c67b16acc4a
maint: Use C++ 'auto' keyword in some instances in liboctave.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
120 auto p = fcn_names.find (name); |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
121 |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
122 if (p == fcn_names.end ()) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
123 fcn_names[name] = 1; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
124 else |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
125 ++(p->second); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
126 } |
3326 | 127 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
128 bool |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
129 dynamic_library::dynlib_rep::remove_fcn_name (const std::string& fcn_name) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
130 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
131 bool retval = false; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
132 |
21862
5c67b16acc4a
maint: Use C++ 'auto' keyword in some instances in liboctave.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
133 auto p = fcn_names.find (fcn_name); |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
134 |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
135 if (p != fcn_names.end () && --(p->second) == 0) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
136 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
137 fcn_names.erase (fcn_name); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
138 retval = true; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
139 } |
3326 | 140 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
141 return retval; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
142 } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
143 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
144 void |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
145 dynamic_library::dynlib_rep::do_close_hook (dynamic_library::close_hook cl_hook) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
146 { |
21876
ef25c202bacc
maint: Clean up for-range usage in liboctave in cset 5c67b16acc4a.
Rik <rik@octave.org>
parents:
21862
diff
changeset
|
147 for (auto& fcn_sz_p : fcn_names) |
ef25c202bacc
maint: Clean up for-range usage in liboctave in cset 5c67b16acc4a.
Rik <rik@octave.org>
parents:
21862
diff
changeset
|
148 cl_hook (fcn_sz_p.first); |
3326 | 149 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
150 fcn_names.clear (); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
151 } |
3326 | 152 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
153 std::map<std::string, dynamic_library::dynlib_rep *> dynamic_library::dynlib_rep::instances; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
154 |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
155 dynamic_library::dynlib_rep dynamic_library::nil_rep; |
3326 | 156 |
4110 | 157 #if defined (HAVE_DLOPEN_API) |
3326 | 158 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
159 class |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
160 octave_dlopen_shlib : public dynamic_library::dynlib_rep |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
161 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
162 public: |
3326 | 163 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
164 octave_dlopen_shlib (const std::string& f); |
3326 | 165 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
166 ~octave_dlopen_shlib (void); |
3326 | 167 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
168 void *search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
169 dynamic_library::name_mangler mangler = 0); |
3326 | 170 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
171 // FIXME: this is possibly redundant because failure to open a library will |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
172 // normally throw an exception, avoiding the construction of an invalid |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21750
diff
changeset
|
173 // library. Leave it here for possible future use. |
3326 | 174 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
175 bool is_open (void) const { return (library != 0); } |
3326 | 176 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
177 private: |
3326 | 178 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
179 // No copying! |
3326 | 180 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
181 octave_dlopen_shlib (const octave_dlopen_shlib&); |
3326 | 182 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
183 octave_dlopen_shlib& operator = (const octave_dlopen_shlib&); |
3326 | 184 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
185 void *library; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
186 }; |
3326 | 187 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
188 octave_dlopen_shlib::octave_dlopen_shlib (const std::string& f) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
189 : dynamic_library::dynlib_rep (f), library (0) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
190 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
191 int flags = 0; |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
192 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
193 // Use RTLD_NOW to resolve all symbols before dlopen returns. |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
194 // By using this option, dlopen will detect errors and Octave |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
195 // won't exit if there are unresolved symbols in the file we are |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
196 // loading, and we may even get a useful diagnostic. |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
197 # if defined (RTLD_NOW) |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
198 flags |= RTLD_NOW; |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
199 # endif |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
200 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
201 // Use RTLD_GLOBAL to export symbols from loaded objects so they are |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
202 // available to other subsequently loaded libraries. |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
203 # if defined (RTLD_GLOBAL) |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
204 flags |= RTLD_GLOBAL; |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21136
diff
changeset
|
205 # endif |
20493
3f01c585f54e
oct-shlib.cc: Use RTLD_GLOBAL option for dlopen
Mike Miller <mtmiller@octave.org>
parents:
19697
diff
changeset
|
206 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
207 library = dlopen (file.c_str (), flags); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
208 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
209 if (! library) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
210 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
211 const char *msg = dlerror (); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
212 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
213 if (msg) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
214 (*current_liboctave_error_handler) ("%s: failed to load: %s", |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
215 file.c_str (), msg); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
216 else |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
217 (*current_liboctave_error_handler) ("%s: failed to load", |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
218 file.c_str ()); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
219 } |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
220 } |
3326 | 221 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
222 octave_dlopen_shlib::~octave_dlopen_shlib (void) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
223 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
224 if (library) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
225 dlclose (library); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
226 } |
3326 | 227 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
228 void * |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
229 octave_dlopen_shlib::search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
230 dynamic_library::name_mangler mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
231 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
232 void *function = 0; |
3326 | 233 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
234 if (! is_open ()) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
235 (*current_liboctave_error_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
236 ("shared library %s is not open", file.c_str ()); |
3326 | 237 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
238 std::string sym_name = name; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
239 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
240 if (mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
241 sym_name = mangler (name); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
242 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
243 function = dlsym (library, sym_name.c_str ()); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
244 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
245 return function; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
246 } |
3326 | 247 |
4110 | 248 #elif defined (HAVE_SHL_LOAD_API) |
3326 | 249 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
250 class |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
251 octave_shl_load_shlib : public dynamic_library::dynlib_rep |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
252 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
253 public: |
3326 | 254 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
255 octave_shl_load_shlib (const std::string& f); |
3326 | 256 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
257 ~octave_shl_load_shlib (void); |
3326 | 258 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
259 void *search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
260 dynamic_library::name_mangler mangler = 0); |
3326 | 261 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
262 bool is_open (void) const { return (library != 0); } |
3326 | 263 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
264 private: |
3326 | 265 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
266 // No copying! |
3326 | 267 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
268 octave_shl_load_shlib (const octave_shl_load_shlib&); |
3326 | 269 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
270 octave_shl_load_shlib& operator = (const octave_shl_load_shlib&); |
3326 | 271 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
272 shl_t library; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
273 }; |
3326 | 274 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
275 octave_shl_load_shlib::octave_shl_load_shlib (const std::string& f) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
276 : dynamic_library::dynlib_rep (f), library (0) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
277 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
278 file = f; |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
279 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
280 library = shl_load (file.c_str (), BIND_IMMEDIATE, 0L); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
281 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
282 if (! library) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
283 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
284 using namespace std; // FIXME: Why have this line? |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21876
diff
changeset
|
285 (*current_liboctave_error_handler) ("%s", std::strerror (errno)); |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
286 } |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
287 } |
3326 | 288 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
289 octave_shl_load_shlib::~octave_shl_load_shlib (void) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
290 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
291 if (library) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
292 shl_unload (library); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
293 } |
3326 | 294 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
295 void * |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
296 octave_shl_load_shlib::search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
297 dynamic_library::name_mangler mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
298 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
299 void *function = 0; |
3326 | 300 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
301 if (! is_open ()) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
302 (*current_liboctave_error_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
303 ("shared library %s is not open", file.c_str ()); |
3326 | 304 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
305 std::string sym_name = name; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
306 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
307 if (mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
308 sym_name = mangler (name); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
309 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
310 int status = shl_findsym (&library, sym_name.c_str (), |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
311 TYPE_UNDEFINED, &function); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
312 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
313 return function; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
314 } |
3326 | 315 |
4110 | 316 #elif defined (HAVE_LOADLIBRARY_API) |
317 | |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
318 class |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
319 octave_w32_shlib: public dynamic_library::dynlib_rep |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
320 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
321 public: |
4110 | 322 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
323 octave_w32_shlib (const std::string& f); |
4110 | 324 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
325 ~octave_w32_shlib (void); |
4110 | 326 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
327 void *search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
328 dynamic_library::name_mangler mangler = 0); |
4110 | 329 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
330 bool is_open (void) const { return (handle != 0); } |
4110 | 331 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
332 private: |
4110 | 333 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
334 // No copying! |
4110 | 335 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
336 octave_w32_shlib (const octave_w32_shlib&); |
4110 | 337 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
338 octave_w32_shlib& operator = (const octave_w32_shlib&); |
4110 | 339 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
340 HINSTANCE handle; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
341 }; |
4110 | 342 |
22146
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
343 static void |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
344 set_dll_directory (const std::string& dir = "") |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
345 { |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
346 SetDllDirectory (dir.empty () ? 0 : dir.c_str ()); |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
347 } |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
348 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
349 octave_w32_shlib::octave_w32_shlib (const std::string& f) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
350 : dynamic_library::dynlib_rep (f), handle (0) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
351 { |
22146
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
352 std::string dir = octave::sys::file_ops::dirname (f); |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
353 |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
354 set_dll_directory (dir); |
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
355 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
356 handle = LoadLibrary (file.c_str ()); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
357 |
22146
ef91e43f162a
set DLL directory when loading DLLs on Windows systems (bug #48511)
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
358 set_dll_directory (); |
22157
c5842206aaea
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
22146
diff
changeset
|
359 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
360 if (! handle) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
361 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
362 DWORD lastError = GetLastError (); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
363 const char *msg; |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
364 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
365 switch (lastError) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
366 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
367 case ERROR_MOD_NOT_FOUND: |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
368 case ERROR_DLL_NOT_FOUND: |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
369 msg = "could not find library or dependencies"; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
370 break; |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
371 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
372 case ERROR_INVALID_DLL: |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
373 msg = "library or its dependencies are damaged"; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
374 break; |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
375 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
376 case ERROR_DLL_INIT_FAILED: |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
377 msg = "library initialization routine failed"; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
378 break; |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
379 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
380 default: |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
381 msg = "library open failed"; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
382 } |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
383 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
384 (*current_liboctave_error_handler) ("%s: %s", msg, file.c_str ()); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
385 } |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
386 } |
4110 | 387 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
388 octave_w32_shlib::~octave_w32_shlib (void) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
389 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
390 if (handle) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
391 FreeLibrary (handle); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
392 } |
4110 | 393 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
394 void * |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
395 octave_w32_shlib::search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
396 dynamic_library::name_mangler mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
397 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
398 void *function = 0; |
4110 | 399 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
400 if (! is_open ()) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
401 (*current_liboctave_error_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
402 ("shared library %s is not open", file.c_str ()); |
4110 | 403 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
404 std::string sym_name = name; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
405 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
406 if (mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
407 sym_name = mangler (name); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
408 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
409 function = reinterpret_cast<void *> (GetProcAddress (handle, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
410 sym_name.c_str ())); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
411 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
412 return function; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
413 } |
4110 | 414 |
4162 | 415 #elif defined (HAVE_DYLD_API) |
416 | |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
417 class |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
418 octave_dyld_shlib : public dynamic_library::dynlib_rep |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
419 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
420 public: |
4162 | 421 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
422 octave_dyld_shlib (void); |
4162 | 423 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
424 ~octave_dyld_shlib (void); |
4162 | 425 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
426 void open (const std::string& f); |
4162 | 427 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
428 void *search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
429 dynamic_library::name_mangler mangler = 0); |
4162 | 430 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
431 void close (dynamic_library::close_hook cl_hook = 0); |
4162 | 432 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
433 bool is_open (void) const {return (handle != 0); } |
4162 | 434 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
435 private: |
4162 | 436 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
437 // No copying! |
4162 | 438 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
439 octave_dyld_shlib (const octave_dyld_shlib&); |
4162 | 440 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
441 octave_dyld_shlib& operator = (const octave_dyld_shlib&); |
4162 | 442 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
443 NSObjectFileImage img; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
444 NSModule handle; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
445 }; |
4162 | 446 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
447 octave_dyld_shlib::octave_dyld_shlib (const std::string& f) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
448 : dynamic_library::dynlib_rep (f), handle (0) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
449 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
450 int returnCode = NSCreateObjectFileImageFromFile (file.c_str (), &img); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
451 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
452 if (NSObjectFileImageSuccess != returnCode) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
453 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
454 (*current_liboctave_error_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
455 ("got NSObjectFileImageReturnCode %d", returnCode); |
9958
80432f0ee895
improve octave_shlib for safer shared libs treatment
Jaroslav Hajek <highegg@gmail.com>
parents:
9493
diff
changeset
|
456 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
457 // FIXME: should use NSLinkEditError () to get |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
458 // more info on what went wrong. |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
459 } |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
460 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
461 handle = NSLinkModule (img, file.c_str (), |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
462 (NSLINKMODULE_OPTION_RETURN_ON_ERROR |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
463 | NSLINKMODULE_OPTION_PRIVATE)); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
464 if (! handle) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
465 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
466 NSLinkEditErrors ler; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
467 int lerno; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
468 const char *file2; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
469 const char *errstr = 0; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
470 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
471 NSLinkEditError (&ler, &lerno, &file2, &errstr); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
472 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
473 if (! errstr) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
474 errstr = "unspecified error"; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
475 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
476 (*current_liboctave_error_handler) ("%s: %s", file.c_str (), errstr); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
477 } |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
478 } |
4162 | 479 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
480 octave_dyld_shlib::~octave_dyld_shlib (void) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
481 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
482 if (handle) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
483 NSUnLinkModule (handle, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); |
4162 | 484 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
485 NSDestroyObjectFileImage (img); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
486 } |
4162 | 487 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
488 void * |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
489 octave_dyld_shlib::search (const std::string& name, |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
490 dynamic_library::name_mangler mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
491 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
492 void *function = 0; |
4162 | 493 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
494 if (! is_open ()) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
495 (*current_liboctave_error_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
496 ("bundle %s is not open", file.c_str ()); |
4162 | 497 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
498 std::string sym_name = name; |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
499 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
500 if (mangler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
501 sym_name = mangler (name); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
502 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
503 NSSymbol symbol = NSLookupSymbolInModule (handle, sym_name.c_str ()); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
504 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
505 if (symbol) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
506 { |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
507 function = NSAddressOfSymbol (symbol); |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
508 } |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
21109
diff
changeset
|
509 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
510 return function; |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
511 } |
4162 | 512 |
3326 | 513 #endif |
514 | |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
515 dynamic_library::dynlib_rep * |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
516 dynamic_library::dynlib_rep::new_instance (const std::string& f) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
517 { |
4110 | 518 #if defined (HAVE_DLOPEN_API) |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
519 return new octave_dlopen_shlib (f); |
4110 | 520 #elif defined (HAVE_SHL_LOAD_API) |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
521 return new octave_shl_load_shlib (f); |
4110 | 522 #elif defined (HAVE_LOADLIBRARY_API) |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
523 return new octave_w32_shlib (f); |
4162 | 524 #elif defined (HAVE_DYLD_API) |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
525 return new octave_dyld_shlib (f); |
3326 | 526 #else |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
527 (*current_liboctave_error_handler) |
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
528 ("support for dynamically loaded libraries was unavailable or disabled when liboctave was built"); |
3326 | 529 #endif |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21736
diff
changeset
|
530 } |
3326 | 531 } |