From 31fa4e78c9eea8257ff1a38b356bea8c82b39826 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Fri, 19 Jan 2007 21:05:28 +0000 Subject: [PATCH] * call libc's exit instead of _exit when doing a halt, so the libc atexit handlers are called git-svn-id: trunk@6078 - --- rtl/bsd/system.pp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rtl/bsd/system.pp b/rtl/bsd/system.pp index 8936912e40..cd162351d1 100644 --- a/rtl/bsd/system.pp +++ b/rtl/bsd/system.pp @@ -53,10 +53,21 @@ Implementation Misc. System Dependent Functions *****************************************************************************} +{$ifdef darwin} +procedure normalexit(status: cint); cdecl; external 'c' name 'exit'; +{$endif} + procedure System_exit; +{$ifndef darwin} begin Fpexit(cint(ExitCode)); -End; +end; +{$else darwin} +begin + { make sure the libc atexit handlers are called, needed for e.g. profiling } + normalexit(cint(ExitCode)); +end; +{$endif darwin} Function ParamCount: Longint;