sysinit.inc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. EntryInformation : TEntryInformation;
  15. InitFinalTable : record end; external name 'INITFINAL';
  16. ThreadvarTablesTable : record end; external name 'FPC_THREADVARTABLES';
  17. valgrind_used : boolean;external name '__fpc_valgrind';
  18. procedure EXE_Entry(const info : TEntryInformation); external name '_FPC_EXE_Entry';
  19. function DLL_Entry(const info : TEntryInformation) : longbool; external name '_FPC_DLL_Entry';
  20. procedure PascalMain;stdcall;external name 'PASCALMAIN';
  21. function GetStdHandle(nStdHandle:DWORD) : THandle; stdcall; external 'kernel32' name 'GetStdHandle';
  22. function GetConsoleMode(hConsoleHandle: THandle; var lpMode: DWORD): Boolean; stdcall; external 'kernel32' name 'GetConsoleMode';
  23. const
  24. STD_INPUT_HANDLE = dword(-10);
  25. procedure SetupEntryInformation;
  26. begin
  27. EntryInformation.InitFinalTable:=@InitFinalTable;
  28. EntryInformation.ThreadvarTablesTable:=@ThreadvarTablesTable;
  29. EntryInformation.asm_exit:=@asm_exit;
  30. EntryInformation.PascalMain:=@PascalMain;
  31. EntryInformation.valgrind_used:=valgrind_used;
  32. end;