si_dllc.pp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2019 by the Free Pascal development team
  4. System Entry point for Haiku shared libraries,
  5. linked-against-libc version
  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_dllc;
  13. interface
  14. implementation
  15. { Bindings to RTL }
  16. var
  17. initialstkptr: pointer; public name '__stkptr';
  18. argc: longint; public name 'operatingsystem_parameter_argc';
  19. argv: pointer; public name 'operatingsystem_parameter_argv';
  20. envp: pointer; public name 'operatingsystem_parameter_envp';
  21. procedure PascalMain; external name 'PASCALMAIN';
  22. { Bindings to libroot/libc }
  23. const
  24. libc = 'root';
  25. var
  26. __libc_argc: longint; external libc name '__libc_argc';
  27. __libc_argv: pointer; external libc name '__libc_argv';
  28. environ: pointer; external libc name 'environ';
  29. procedure __exit(status: longint); cdecl; external libc name 'exit';
  30. procedure _FPC_shared_lib_start; cdecl; public name 'initialize_after';
  31. begin
  32. initialstkptr:=get_frame;
  33. argc:=__libc_argc;
  34. argv:=__libc_argv;
  35. envp:=environ;
  36. PascalMain;
  37. end;
  38. procedure _FPC_shared_lib_halt(_ExitCode: longint); cdecl; public name '_haltproc';
  39. begin
  40. { call C exit code }
  41. __exit(_ExitCode);
  42. end;
  43. end.