Browse Source

* call libc's exit instead of _exit when doing a halt, so the
libc atexit handlers are called

git-svn-id: trunk@6078 -

Jonas Maebe 18 years ago
parent
commit
31fa4e78c9
1 changed files with 12 additions and 1 deletions
  1. 12 1
      rtl/bsd/system.pp

+ 12 - 1
rtl/bsd/system.pp

@@ -53,10 +53,21 @@ Implementation
                        Misc. System Dependent Functions
                        Misc. System Dependent Functions
 *****************************************************************************}
 *****************************************************************************}
 
 
+{$ifdef darwin}
+procedure normalexit(status: cint); cdecl; external 'c' name 'exit';
+{$endif}
+
 procedure System_exit;
 procedure System_exit;
+{$ifndef darwin}
 begin
 begin
    Fpexit(cint(ExitCode));
    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;
 Function ParamCount: Longint;