GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-dld-fcn.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2013 John W. Eaton
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
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
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
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
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 
37 
39  "dynamically-linked function",
40  "dynamically-linked function");
41 
42 
45  const std::string& nm, const std::string& ds)
46  : octave_builtin (ff, nm, ds), sh_lib (shl)
47 {
48  mark_fcn_file_up_to_date (time_parsed ());
49 
50  std::string file_name = fcn_file_name ();
51 
52  system_fcn_file
53  = (! file_name.empty ()
54  && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ()));
55 }
56 
58 {
60 }
61 
62 std::string
64 {
65  return sh_lib.file_name ();
66 }
67 
70 {
71  return sh_lib.time_loaded ();
72 }
73 
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 
87  const std::string& nm, const std::string& ds)
88 {
89  return new octave_dld_function (ff, shl, nm, ds);
90 }