sysinit.pas 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by the Free Pascal development team
  4. Implements indirect entry point for executables and libaries
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. unit sysinit;
  12. interface
  13. implementation
  14. {$ifndef ver2_6}
  15. procedure PascalMain; external name 'PASCALMAIN';
  16. procedure SysEntry(constref info: TEntryInformation); external name 'FPC_SysEntry';
  17. var
  18. InitFinalTable : record end; external name 'INITFINAL';
  19. ThreadvarTablesTable : record end; external name 'FPC_THREADVARTABLES';
  20. {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
  21. WideInitTables : record end; external name 'FPC_WIDEINITTABLES';
  22. {$endif}
  23. {$ifdef FPC_HAS_RESSTRINITS}
  24. ResStrInitTables : record end; external name 'FPC_RESSTRINITTABLES';
  25. {$endif}
  26. ResLocation: record end; external name 'FPC_RESLOCATION';
  27. ResourceStringTables : record end; external name 'FPC_RESOURCESTRINGTABLES';
  28. StkLen: SizeUInt; external name '__stklen';
  29. const
  30. SysInitEntryInformation : TEntryInformation = (
  31. InitFinalTable : @InitFinalTable;
  32. ThreadvarTablesTable : @ThreadvarTablesTable;
  33. ResourceStringTables : @ResourceStringTables;
  34. {$ifdef FPC_HAS_RESSTRINITS}
  35. ResStrInitTables : @ResStrInitTables;
  36. {$else}
  37. ResStrInitTables : nil;
  38. {$endif}
  39. {$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
  40. WideInitTables : @WideInitTables;
  41. {$endif}
  42. ResLocation : @ResLocation;
  43. asm_exit : nil;
  44. PascalMain : @PascalMain;
  45. valgrind_used : false;
  46. Platform: (
  47. argc: 0;
  48. argv: nil;
  49. envp: nil;
  50. stklen: 0;
  51. );
  52. );
  53. procedure FPC_SYSTEMMAIN(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
  54. begin
  55. SysInitEntryInformation.Platform.argc := argcparam;
  56. SysInitEntryInformation.Platform.argv := argvparam;
  57. SysInitEntryInformation.Platform.envp := envpparam;
  58. SysInitEntryInformation.Platform.stklen := StkLen;
  59. SysEntry(SysInitEntryInformation);
  60. end;
  61. procedure FPC_LIBMAIN; cdecl; [public];
  62. begin
  63. SysEntry(SysInitEntryInformation);
  64. end;
  65. {$endif ver2_6}
  66. end.