Explorar o código

* 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 %!s(int64=18) %!d(string=hai) anos
pai
achega
31fa4e78c9
Modificáronse 1 ficheiros con 12 adicións e 1 borrados
  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;