octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: MSVC compiler support [patch 17]: octinterp.dll exported symbols


From: John W. Eaton
Subject: RE: MSVC compiler support [patch 17]: octinterp.dll exported symbols
Date: Sat, 28 Oct 2006 12:30:43 -0400

On 27-Oct-2006, address@hidden wrote:

| > Is it OK to do the use OCTAVE_EXPORT, and define that appropriately in
| > config.h?  Currently, OCTAVE_EXPORT is defined to be empty unless
| > _MSC_VER is defined, but that might change in the future.
| 
| OK.
| 
| > This seems to be needed because HAVE_ATEXIT is not defined.  Is atexit
| > really not available, or is there some problem with it?  If there was
| > a problem, I'd like to try to find a solution because we need to have
| > some kind of atexit functionality.
| 
| atexit() is available under MSVC. I don't remember why I did it (probably
| while trying something), but from a code point-of-view, such an include
| would be necessary if HAVE_ATEXIT is not defined. From a MSVC point
| of view, you can leave out this change.

I think the following change should be OK because the scripting
language atexit function just pushes the name of the function it is
given onto the stack of functions to call when Octave exits.  A
separate function is registered with the C-language atexit function to
process this list (this is done in octave_main in src/octave.cc).  If
Octave exits normally (via the clean_up_and_exit function defined in
src/toplev.cc), the list of functions is processed before the
C-language exit function is called.  So if the C-language atexit
function is missing, things will work properly unless Octave exits
abnormally.  If Octave is crashing, then there is no guarantee that
any function we try to call via atexit will work properly, so I don't
think there is much reason to worry about not having atexit.

jwe

src/ChangeLog:

2006-10-28  John W. Eaton  <address@hidden>

        * toplev.cc (Fatexit): Push function names on the stack even if we
        don't have atexit or on_exit.


Index: src/toplev.cc
===================================================================
RCS file: /cvs/octave/src/toplev.cc,v
retrieving revision 1.189
diff -u -u -r1.189 toplev.cc
--- src/toplev.cc       24 Oct 2006 01:00:13 -0000      1.189
+++ src/toplev.cc       28 Oct 2006 16:23:35 -0000
@@ -674,16 +674,12 @@
 
   if (nargin == 1)
     {
-#if defined (HAVE_ATEXIT) || defined (HAVE_ON_EXIT)
       std::string arg = args(0).string_value ();
 
       if (! error_state)
        octave_atexit_functions.push (arg);
       else
        error ("atexit: argument must be a string");
-#else
-      gripe_not_supported ("atexit");
-#endif
     }
   else
     print_usage ();

reply via email to

[Prev in Thread] Current Thread [Next in Thread]