Mercurial > octave-nkf
annotate src/ov-dld-fcn.cc @ 12770:3666e8e6f96e stable release-3-4-2
Version 3.4.2 released.
* configure.ac (AC_INIT): Version is now 3.4.2.
(OCTAVE_RELEASE_DATE): Now 2011-06-24.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 24 Jun 2011 10:36:40 -0400 |
parents | fd0a3ac60b0e |
children | 72c96de7a403 |
rev | line source |
---|---|
3329 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 John W. Eaton |
3329 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3329 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3329 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #include "oct-shlib.h" | |
28 | |
29 #include <defaults.h> | |
30 #include "dynamic-ld.h" | |
31 #include "error.h" | |
32 #include "oct-obj.h" | |
33 #include "ov-dld-fcn.h" | |
34 #include "ov.h" | |
35 | |
36 DEFINE_OCTAVE_ALLOCATOR (octave_dld_function); | |
37 | |
38 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_dld_function, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10184
diff
changeset
|
39 "dynamically-linked function", |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10184
diff
changeset
|
40 "dynamically-linked function"); |
3329 | 41 |
42 | |
43 octave_dld_function::octave_dld_function | |
44 (octave_builtin::fcn ff, const octave_shlib& shl, | |
3523 | 45 const std::string& nm, const std::string& ds) |
3329 | 46 : octave_builtin (ff, nm, ds), sh_lib (shl) |
47 { | |
48 mark_fcn_file_up_to_date (time_parsed ()); | |
49 | |
3523 | 50 std::string file_name = fcn_file_name (); |
3329 | 51 |
52 system_fcn_file | |
53 = (! file_name.empty () | |
5397 | 54 && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ())); |
3329 | 55 } |
56 | |
57 octave_dld_function::~octave_dld_function (void) | |
58 { | |
7872 | 59 octave_dynamic_loader::remove_oct (my_name, sh_lib); |
3329 | 60 } |
61 | |
3536 | 62 std::string |
3329 | 63 octave_dld_function::fcn_file_name (void) const |
64 { | |
65 return sh_lib.file_name (); | |
66 } | |
67 | |
68 octave_time | |
69 octave_dld_function::time_parsed (void) const | |
70 { | |
71 return sh_lib.time_loaded (); | |
72 } | |
73 | |
7349 | 74 // Note: this wrapper around the octave_dld_function constructor is |
75 // necessary to work around a MSVC limitation handling in | |
76 // virtual destructors that prevents unloading a dynamic module | |
77 // before *all* objects (of class using a virtual dtor) have | |
78 // been fully deleted; indeed, MSVC attaches auto-generated code | |
79 // (scalar deleting destructor) to objects created in a dynamic | |
80 // module, and this code will be executed in the dynamic module | |
81 // context at object deletion; unloading the dynamic module | |
82 // before objects have been deleted will make the "delete" code | |
83 // of objects to point to an invalid code segment. | |
84 | |
85 octave_dld_function* | |
86 octave_dld_function::create (octave_builtin::fcn ff, const octave_shlib& shl, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10184
diff
changeset
|
87 const std::string& nm, const std::string& ds) |
7349 | 88 { |
89 return new octave_dld_function (ff, shl, nm, ds); | |
90 } |