# HG changeset patch # User jwe # Date 1199716824 0 # Node ID a1ab9dbc962245548fdc37b61a06ee427f981dea # Parent d1a97ad872647e5dec94227454e244bf14c28fb8 [project @ 2008-01-07 14:40:23 by jwe] diff -r d1a97ad87264 -r a1ab9dbc9622 src/ChangeLog --- a/src/ChangeLog Fri Jan 04 21:49:15 2008 +0000 +++ b/src/ChangeLog Mon Jan 07 14:40:24 2008 +0000 @@ -1,3 +1,13 @@ +2008-01-07 Michael Goffioul + + * 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 * debug.cc (bp_table::do_remove_all_breakpoints_in_file): diff -r d1a97ad87264 -r a1ab9dbc9622 src/defun-int.h --- a/src/defun-int.h Fri Jan 04 21:49:15 2008 +0000 +++ b/src/defun-int.h Mon Jan 07 14:40:24 2008 +0000 @@ -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 (); \ diff -r d1a97ad87264 -r a1ab9dbc9622 src/ov-builtin.h --- a/src/ov-builtin.h Fri Jan 04 21:49:15 2008 +0000 +++ b/src/ov-builtin.h Mon Jan 07 14:40:24 2008 +0000 @@ -35,6 +35,7 @@ // Builtin functions. class +OCTINTERP_API octave_builtin : public octave_function { public: diff -r d1a97ad87264 -r a1ab9dbc9622 src/ov-dld-fcn.cc --- a/src/ov-dld-fcn.cc Fri Jan 04 21:49:15 2008 +0000 +++ b/src/ov-dld-fcn.cc Mon Jan 07 14:40:24 2008 +0000 @@ -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++ *** diff -r d1a97ad87264 -r a1ab9dbc9622 src/ov-dld-fcn.h --- a/src/ov-dld-fcn.h Fri Jan 04 21:49:15 2008 +0000 +++ b/src/ov-dld-fcn.h Mon Jan 07 14:40:24 2008 +0000 @@ -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: