Bläddra i källkod

* 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 år sedan
förälder
incheckning
31fa4e78c9
1 ändrade filer med 12 tillägg och 1 borttagningar
  1. 12 1
      rtl/bsd/system.pp

+ 12 - 1
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;