sysinit.inc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2006 by Florian Klaempfl and Pavel Ozerski
  4. member of the Free Pascal development team.
  5. Win32 startup code, shared part
  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. var
  13. SysInstance : Longint;external name '_FPC_SysInstance';
  14. InitFinalTable : record end; external name 'INITFINAL';
  15. ThreadvarTablesTable : record end; external name 'FPC_THREADVARTABLES';
  16. valgrind_used : boolean;external name '__fpc_valgrind';
  17. {$if defined(FPC_USE_TLS_DIRECTORY) or defined(FPC_SECTION_THREADVARS)}
  18. var
  19. tlsdir: record end; external name '__tls_used';
  20. procedure LinkIn(p1,p2,p3: Pointer); inline;
  21. begin
  22. end;
  23. {$endif}
  24. {$ifdef FPC_USE_TLS_DIRECTORY}
  25. var
  26. tls_callback_end: pointer; external name '__FPC_end_of_tls_callbacks';
  27. tls_callback: pointer; external name '__FPC_tls_callbacks';
  28. {$endif FPC_USE_TLS_DIRECTORY}
  29. procedure EXE_Entry(const info : TEntryInformation); external name '_FPC_EXE_Entry';
  30. function DLL_Entry(const info : TEntryInformation) : longbool; external name '_FPC_DLL_Entry';
  31. procedure PascalMain;stdcall;external name 'PASCALMAIN';
  32. function GetStdHandle(nStdHandle:DWORD) : THandle; stdcall; external 'kernel32' name 'GetStdHandle';
  33. function GetConsoleMode(hConsoleHandle: THandle; var lpMode: DWORD): Boolean; stdcall; external 'kernel32' name 'GetConsoleMode';
  34. const
  35. STD_INPUT_HANDLE = dword(-10);
  36. SysInitEntryInformation : TEntryInformation = (
  37. InitFinalTable : @InitFinalTable;
  38. ThreadvarTablesTable : @ThreadvarTablesTable;
  39. asm_exit : @asm_exit;
  40. PascalMain : @PascalMain;
  41. valgrind_used : false;
  42. );
  43. procedure SetupEntryInformation;
  44. begin
  45. { valgind_used is the only thng that can change at startup
  46. EntryInformation.InitFinalTable:=@InitFinalTable;
  47. EntryInformation.ThreadvarTablesTable:=@ThreadvarTablesTable;
  48. EntryInformation.asm_exit:=@asm_exit;
  49. EntryInformation.PascalMain:=@PascalMain;}
  50. SysInitEntryInformation.valgrind_used:=valgrind_used;
  51. end;
  52. {$define FPC_INSSIDE_SYSINIT}
  53. {$include systlsdir.inc}