sysinitcyg.pp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 cygwin 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 sysinitcyg;
  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. procedure Cygwin_crt0(p : pointer);cdecl;external name 'cygwin_crt0';
  20. procedure __main;cdecl;external name '__main';
  21. procedure CMainEXE;cdecl;
  22. begin
  23. asm
  24. subl $0x8,%esp
  25. andl $0xfffffff0,%esp
  26. end;
  27. __main;
  28. EXE_Entry;
  29. end;
  30. procedure CMainDLL;cdecl;
  31. begin
  32. asm
  33. subl $0x8,%esp
  34. andl $0xfffffff0,%esp
  35. end;
  36. __main;
  37. DLL_Entry;
  38. end;
  39. procedure _FPC_mainCRTStartup;stdcall;public name '_mainCRTStartup';
  40. begin
  41. IsConsole:=true;
  42. asm
  43. subl $0x8,%esp
  44. andl $0xfffffff0,%esp
  45. end;
  46. Cygwin_crt0(@CMainEXE);
  47. end;
  48. procedure _FPC_WinMainCRTStartup;stdcall;public name '_WinMainCRTStartup';
  49. begin
  50. IsConsole:=false;
  51. asm
  52. subl $0x8,%esp
  53. andl $0xfffffff0,%esp
  54. end;
  55. Cygwin_crt0(@CMainEXE);
  56. end;
  57. procedure _FPC_DLLMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLMainCRTStartup';
  58. begin
  59. IsConsole:=true;
  60. sysinstance:=_hinstance;
  61. dllreason:=_dllreason;
  62. dllparam:=_dllparam;
  63. asm
  64. subl $0x8,%esp
  65. andl $0xfffffff0,%esp
  66. end;
  67. Cygwin_crt0(@CMainDLL);
  68. end;
  69. procedure _FPC_DLLWinMainCRTStartup(_hinstance,_dllreason,_dllparam:longint);stdcall;public name '_DLLWinMainCRTStartup';
  70. begin
  71. IsConsole:=false;
  72. sysinstance:=_hinstance;
  73. dllreason:=_dllreason;
  74. dllparam:=_dllparam;
  75. asm
  76. subl $0x8,%esp
  77. andl $0xfffffff0,%esp
  78. end;
  79. Cygwin_crt0(@CMainDLL);
  80. end;
  81. end.