Mercurial > hg > octave-max
changeset 7349:a1ab9dbc9622
[project @ 2008-01-07 14:40:23 by jwe]
author | jwe |
---|---|
date | Mon, 07 Jan 2008 14:40:24 +0000 |
parents | d1a97ad87264 |
children | 288614c6634d |
files | src/ChangeLog src/defun-int.h src/ov-builtin.h src/ov-dld-fcn.cc src/ov-dld-fcn.h |
diffstat | 5 files changed, 36 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2008-01-07 Michael Goffioul <michael.goffioul@gmail.com> + + * ov-builtin.h (octave_builtin): Tag with OCTINTERP_API. + * ov-dld-fcn.h (octave_dld_function): Likewise. + + * ov-dld-fcn.cc (octave_dld_function::create): New function. + * ov-dld-fcn.h: Provide decl. + * defun.h (DEFINE_FUNX_INSTALLER_FUN3): Call it instead of + creating a new octave_dld_function object directly. + 2008-01-04 John Swensen <jpswensen@comcast.net> * debug.cc (bp_table::do_remove_all_breakpoints_in_file):
--- a/src/defun-int.h +++ b/src/defun-int.h @@ -120,7 +120,7 @@ \ if (! error_state) \ { \ - octave_dld_function *fcn = new octave_dld_function (fname, shl, name, doc); \ + octave_dld_function *fcn = octave_dld_function::create (fname, shl, name, doc); \ \ if (relative) \ fcn->mark_relative (); \
--- a/src/ov-builtin.h +++ b/src/ov-builtin.h @@ -35,6 +35,7 @@ // Builtin functions. class +OCTINTERP_API octave_builtin : public octave_function { public:
--- a/src/ov-dld-fcn.cc +++ b/src/ov-dld-fcn.cc @@ -72,6 +72,24 @@ return sh_lib.time_loaded (); } +// Note: this wrapper around the octave_dld_function constructor is +// necessary to work around a MSVC limitation handling in +// virtual destructors that prevents unloading a dynamic module +// before *all* objects (of class using a virtual dtor) have +// been fully deleted; indeed, MSVC attaches auto-generated code +// (scalar deleting destructor) to objects created in a dynamic +// module, and this code will be executed in the dynamic module +// context at object deletion; unloading the dynamic module +// before objects have been deleted will make the "delete" code +// of objects to point to an invalid code segment. + +octave_dld_function* +octave_dld_function::create (octave_builtin::fcn ff, const octave_shlib& shl, + const std::string& nm, const std::string& ds) +{ + return new octave_dld_function (ff, shl, nm, ds); +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/ov-dld-fcn.h +++ b/src/ov-dld-fcn.h @@ -40,6 +40,7 @@ // Dynamically-linked functions. class +OCTINTERP_API octave_dld_function : public octave_builtin { public: @@ -65,6 +66,11 @@ bool is_builtin_function (void) const { return false; } bool is_dld_function (void) const { return true; } + + 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 ()); private: