GNU Octave  4.2.1
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-2017 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 #if defined (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 "ovl.h"
33 #include "ov-dld-fcn.h"
34 #include "ov.h"
35 
36 
38  "dynamically-linked function",
39  "dynamically-linked function");
40 
43  const std::string& nm, const std::string& ds)
44  : octave_builtin (ff, nm, ds), sh_lib (shl)
45 {
46  mark_fcn_file_up_to_date (time_parsed ());
47 
48  std::string file_name = fcn_file_name ();
49 
50  system_fcn_file
51  = (! file_name.empty ()
52  && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ()));
53 }
54 
56 {
58 }
59 
62 {
63  return sh_lib.file_name ();
64 }
65 
68 {
69  return sh_lib.time_loaded ();
70 }
71 
72 // Note: this wrapper around the octave_dld_function constructor is
73 // necessary to work around a MSVC limitation handling in
74 // virtual destructors that prevents unloading a dynamic module
75 // before *all* objects (of class using a virtual dtor) have
76 // been fully deleted; indeed, MSVC attaches auto-generated code
77 // (scalar deleting destructor) to objects created in a dynamic
78 // module, and this code will be executed in the dynamic module
79 // context at object deletion; unloading the dynamic module
80 // before objects have been deleted will make the "delete" code
81 // of objects to point to an invalid code segment.
82 
85  const octave::dynamic_library& shl,
86  const std::string& nm, const std::string& ds)
87 {
88  return new octave_dld_function (ff, shl, nm, ds);
89 }
std::string my_name
Definition: ov-fcn.h:210
octave_value_list(* fcn)(const octave_value_list &, int)
Definition: ov-builtin.h:47
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:169
static bool remove_oct(const std::string &fcn_name, octave::dynamic_library &shl)
Definition: dynamic-ld.cc:416
~octave_dld_function(void)
Definition: ov-dld-fcn.cc:55
static std::string fcn_file_name(const octave_value &fcn)
Definition: symtab.cc:1168
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:941
octave_dld_function(void)
Definition: ov-dld-fcn.h:47
std::string fcn_file_name(void) const
Definition: ov-dld-fcn.cc:61
octave::sys::time time_parsed(void) const
Definition: ov-dld-fcn.cc:67
static octave_dld_function * create(octave_builtin::fcn ff, const octave::dynamic_library &shl, const std::string &nm="", const std::string &ds="")
Definition: ov-dld-fcn.cc:84
std::string Voct_file_dir
Definition: defaults.cc:78
octave::sys::time time_loaded(void) const
Definition: oct-shlib.h:188
std::string file_name(void) const
Definition: oct-shlib.h:185
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
octave::dynamic_library sh_lib
Definition: ov-dld-fcn.h:81