+ added unhandled exception handling code for the branchful exceptions mode

This commit is contained in:
Nikolay Nikolov 2021-10-05 04:06:56 +03:00
parent a01a602140
commit c0cec218d6
2 changed files with 18 additions and 1 deletions

View File

@ -17,6 +17,10 @@
unit si_prc;
{$ifdef FPC_WASM_BRANCHFUL_EXCEPTIONS}
{$MODESWITCH EXCEPTIONS}
{$endif}
interface
procedure _start;
@ -25,10 +29,23 @@ implementation
procedure PASCALMAIN; external 'PASCALMAIN';
{$ifdef FPC_WASM_BRANCHFUL_EXCEPTIONS}
Procedure DoUnHandledException; external name 'FPC_DOUNHANDLEDEXCEPTION';
procedure _start;
begin
try
PASCALMAIN;
except
DoUnhandledException;
end;
end;
{$else}
procedure _start;
begin
PASCALMAIN;
end;
{$endif}
exports
_start;

View File

@ -134,7 +134,7 @@ begin
Result:=NewObj;
end;
Procedure DoUnHandledException;
Procedure DoUnHandledException;[Public, Alias : 'FPC_DOUNHANDLEDEXCEPTION'];
var
_ExceptObjectStack : PExceptObject;
begin