sysinitpas.pp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 pascal only startup code
  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 sysinitpas;
  13. interface
  14. implementation
  15. var
  16. SysInstance : Longint;external name '_FPC_SysInstance';
  17. procedure EXE_Entry; external name '_FPC_EXE_Entry';
  18. function DLL_entry : longbool; external name '_FPC_DLL_Entry';
  19. const
  20. STD_INPUT_HANDLE = dword(-10);
  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. procedure _FPC_mainCRTStartup;stdcall;public name '_mainCRTStartup';
  24. begin
  25. IsConsole:=true;
  26. { do it like it is necessary for the startup code linking against cygwin }
  27. GetConsoleMode(GetStdHandle((Std_Input_Handle)),StartupConsoleMode);
  28. Exe_entry;
  29. end;
  30. procedure _FPC_WinMainCRTStartup;stdcall;public name '_WinMainCRTStartup';
  31. begin
  32. IsConsole:=false;
  33. Exe_entry;
  34. end;
  35. procedure _FPC_DLLMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLMainCRTStartup';
  36. begin
  37. IsConsole:=true;
  38. sysinstance:=_hinstance;
  39. dllreason:=_dllreason;
  40. dllparam:=_dllparam;
  41. DLL_Entry;
  42. end;
  43. procedure _FPC_DLLWinMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLWinMainCRTStartup';
  44. begin
  45. IsConsole:=false;
  46. sysinstance:=_hinstance;
  47. dllreason:=_dllreason;
  48. dllparam:=_dllparam;
  49. DLL_Entry;
  50. end;
  51. procedure asm_exit;stdcall;public name 'asm_exit';
  52. begin
  53. end;
  54. end.