GNU Octave  4.0.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-2015 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 
36 
38  "dynamically-linked function",
39  "dynamically-linked function");
40 
41 
44  const std::string& nm, const std::string& ds)
45  : octave_builtin (ff, nm, ds), sh_lib (shl)
46 {
47  mark_fcn_file_up_to_date (time_parsed ());
48 
49  std::string file_name = fcn_file_name ();
50 
51  system_fcn_file
52  = (! file_name.empty ()
53  && Voct_file_dir == file_name.substr (0, Voct_file_dir.length ()));
54 }
55 
57 {
59 }
60 
61 std::string
63 {
64  return sh_lib.file_name ();
65 }
66 
69 {
70  return sh_lib.time_loaded ();
71 }
72 
73 // Note: this wrapper around the octave_dld_function constructor is
74 // necessary to work around a MSVC limitation handling in
75 // virtual destructors that prevents unloading a dynamic module
76 // before *all* objects (of class using a virtual dtor) have
77 // been fully deleted; indeed, MSVC attaches auto-generated code
78 // (scalar deleting destructor) to objects created in a dynamic
79 // module, and this code will be executed in the dynamic module
80 // context at object deletion; unloading the dynamic module
81 // before objects have been deleted will make the "delete" code
82 // of objects to point to an invalid code segment.
83 
86  const std::string& nm, const std::string& ds)
87 {
88  return new octave_dld_function (ff, shl, nm, ds);
89 }
octave_time time_loaded(void) const
Definition: oct-shlib.h:184
std::string my_name
Definition: ov-fcn.h:208
octave_value_list(* fcn)(const octave_value_list &, int)
Definition: ov-builtin.h:45
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:164
static octave_dld_function * create(octave_builtin::fcn ff, const octave_shlib &shl, const std::string &nm=std::string(), const std::string &ds=std::string())
Definition: ov-dld-fcn.cc:85
~octave_dld_function(void)
Definition: ov-dld-fcn.cc:56
static std::string fcn_file_name(const octave_value &fcn)
Definition: symtab.cc:1163
octave_dld_function(void)
Definition: ov-dld-fcn.h:47
octave_time time_parsed(void) const
Definition: ov-dld-fcn.cc:68
std::string fcn_file_name(void) const
Definition: ov-dld-fcn.cc:62
static bool remove_oct(const std::string &fcn_name, octave_shlib &shl)
Definition: dynamic-ld.cc:436
std::string Voct_file_dir
Definition: defaults.cc:81
octave_shlib sh_lib
Definition: ov-dld-fcn.h:81
std::string file_name(void) const
Definition: oct-shlib.h:181