[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
exposing do_octave_atexit in the API
From: |
c. |
Subject: |
exposing do_octave_atexit in the API |
Date: |
Tue, 11 Feb 2014 16:37:25 +0100 |
Hi,
I'm embedding the interpreter in an MPI application,
so I need to call both clean_up_and_exit (0) and MPI_Finalize () at the and of
my code.
Unfortunately whatever order I choose causes a crash when the application tries
to exit.
By applying the patch below to toplev.{cc,h} I can di
do_octave_atexit ();
MPI_Finalize ();
return (0);
and have my application shut down gracefully.
Does anyone know whether this patch is harmful in any way?
Would it be OK to apply it in the repository?
Is there a better way to achieve the same?
Thanks,
c.
diff --git a/libinterp/corefcn/toplev.cc b/libinterp/corefcn/toplev.cc
--- a/libinterp/corefcn/toplev.cc
+++ b/libinterp/corefcn/toplev.cc
@@ -662,7 +662,7 @@
static std::list<std::string> octave_atexit_functions;
-static void
+void
do_octave_atexit (void)
{
static bool deja_vu = false;
diff --git a/libinterp/corefcn/toplev.h b/libinterp/corefcn/toplev.h
--- a/libinterp/corefcn/toplev.h
+++ b/libinterp/corefcn/toplev.h
@@ -485,4 +485,7 @@
} \
while (0)
+void
+do_octave_atexit (void);
+
#endif
- exposing do_octave_atexit in the API,
c. <=