|
@@ -802,18 +802,12 @@ end;
|
|
*****************************************************************************}
|
|
*****************************************************************************}
|
|
|
|
|
|
procedure PascalMain;stdcall;external name 'PASCALMAIN';
|
|
procedure PascalMain;stdcall;external name 'PASCALMAIN';
|
|
-procedure fpc_do_exit;stdcall;external name 'FPC_DO_EXIT';
|
|
|
|
procedure ExitThread(Exitcode : longint); external 'coredll';
|
|
procedure ExitThread(Exitcode : longint); external 'coredll';
|
|
|
|
|
|
Procedure system_exit;
|
|
Procedure system_exit;
|
|
begin
|
|
begin
|
|
- SysFreeMem(FCmdLine);
|
|
|
|
- { don't call ExitProcess inside
|
|
|
|
- the DLL exit code !!
|
|
|
|
- This crashes Win95 at least PM }
|
|
|
|
if IsLibrary then
|
|
if IsLibrary then
|
|
exit;
|
|
exit;
|
|
-// ExitDLL(ExitCode);
|
|
|
|
if not IsConsole then
|
|
if not IsConsole then
|
|
begin
|
|
begin
|
|
Close(stderr);
|
|
Close(stderr);
|
|
@@ -876,7 +870,7 @@ begin
|
|
end;
|
|
end;
|
|
DLL_PROCESS_DETACH :
|
|
DLL_PROCESS_DETACH :
|
|
begin
|
|
begin
|
|
- FPC_Do_Exit;
|
|
|
|
|
|
+ Lib_Exit;
|
|
if assigned(Dll_Process_Detach_Hook) then
|
|
if assigned(Dll_Process_Detach_Hook) then
|
|
Dll_Process_Detach_Hook(DllParam);
|
|
Dll_Process_Detach_Hook(DllParam);
|
|
end;
|
|
end;
|
|
@@ -1471,8 +1465,6 @@ begin
|
|
{$endif WINCE_EXCEPTION_HANDLING}
|
|
{$endif WINCE_EXCEPTION_HANDLING}
|
|
end;
|
|
end;
|
|
{$endif CPUI386}
|
|
{$endif CPUI386}
|
|
- { if we pass here there was no error ! }
|
|
|
|
- system_exit;
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure _FPC_mainCRTStartup;stdcall;public name '_mainCRTStartup';
|
|
procedure _FPC_mainCRTStartup;stdcall;public name '_mainCRTStartup';
|
|
@@ -1777,7 +1769,17 @@ begin
|
|
result := stklen;
|
|
result := stklen;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure SysCleanup;
|
|
|
|
+var
|
|
|
|
+ i: integer;
|
|
begin
|
|
begin
|
|
|
|
+ SysFreeMem(FCmdLine);
|
|
|
|
+ for i:=0 to argc do
|
|
|
|
+ sysfreemem(argv[i]);
|
|
|
|
+ sysfreemem(argv);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+initialization
|
|
StackLength := CheckInitialStkLen(InitialStkLen);
|
|
StackLength := CheckInitialStkLen(InitialStkLen);
|
|
StackBottom := StackTop - StackLength;
|
|
StackBottom := StackTop - StackLength;
|
|
{ Enable FPU exceptions }
|
|
{ Enable FPU exceptions }
|
|
@@ -1806,4 +1808,9 @@ begin
|
|
initvariantmanager;
|
|
initvariantmanager;
|
|
initwidestringmanager;
|
|
initwidestringmanager;
|
|
InitWinCEWidestrings
|
|
InitWinCEWidestrings
|
|
|
|
+
|
|
|
|
+finalization
|
|
|
|
+ { Cleanup }
|
|
|
|
+ SysCleanup;
|
|
|
|
+
|
|
end.
|
|
end.
|