Skip to content
Browse files

Use atexit to invoke application-exit functions.

This was using a destructor function but it doesn't appear that
that was working after we started using constructor functions
and might call exit from within a constructor function.

Fixes #219.
  • Loading branch information...
1 parent 46ceee3 commit 2e5da83ee84156bbd2bf49a90657b5cd1675f768 @waywardmonkeys waywardmonkeys committed Jun 3, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 sources/dfmc/c-run-time/run-time.c
View
3 sources/dfmc/c-run-time/run-time.c
@@ -4678,7 +4678,7 @@ static BS9 bs_boole_xor_ = {
void GC_set_max_heap_size(unsigned long);
-static __attribute__((destructor)) void call_application_exit_functions(void) {
+static void call_application_exit_functions(void) {
extern D Kcall_application_exit_functionsVKeI();
(void) Kcall_application_exit_functionsVKeI();
}
@@ -4692,6 +4692,7 @@ void _Init_Run_Time ()
initp = 1;
trace_init();
trace_runtime("Initializing runtime");
+ atexit(call_application_exit_functions);
GC_init();
initialize_threads_primitives();
GC_set_max_heap_size(MAX_HEAP_SIZE);

0 comments on commit 2e5da83

Please sign in to comment.
Something went wrong with that request. Please try again.