si_prc.pp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2021 by Free Pascal development team
  4. This file implements the startup code for WebAssembly programs that
  5. don't link to the C library.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit si_prc;
  13. {$if defined(FPC_WASM_BRANCHFUL_EXCEPTIONS) or defined(FPC_WASM_NATIVE_EXCEPTIONS)}
  14. {$MODESWITCH EXCEPTIONS}
  15. {$endif}
  16. interface
  17. procedure _start;
  18. implementation
  19. procedure PASCALMAIN; external 'PASCALMAIN';
  20. {$if defined(FPC_WASM_BRANCHFUL_EXCEPTIONS) or defined(FPC_WASM_NATIVE_EXCEPTIONS)}
  21. Procedure DoUnHandledException; external name 'FPC_DOUNHANDLEDEXCEPTION';
  22. procedure _start;
  23. begin
  24. try
  25. PASCALMAIN;
  26. except
  27. DoUnhandledException;
  28. end;
  29. end;
  30. {$else}
  31. procedure _start;
  32. begin
  33. PASCALMAIN;
  34. end;
  35. {$endif}
  36. exports
  37. _start,
  38. _start name '_start_promising' promising;
  39. end.