initc.pp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2004 by the Free Pascal development team.
  4. This file handles the libc errno abstraction.
  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 initc;
  12. interface
  13. type libcint = longint;
  14. plibcint = ^libcint;
  15. function fpgetCerrno:libcint;
  16. procedure fpsetCerrno(err:libcint);
  17. {$ifdef HASGLOBALPROPERTY}
  18. property cerrno:libcint read fpgetCerrno write fpsetcerrno;
  19. {$endif HASGLOBALPROPERTY}
  20. implementation
  21. const clib = 'libc';
  22. function geterrnolocation: Plibcint; cdecl;external clib name '___errno';
  23. function fpgetCerrno:libcint;
  24. begin
  25. fpgetCerrno:=geterrnolocation^;
  26. end;
  27. procedure fpsetCerrno(err:libcint);
  28. begin
  29. geterrnolocation^:=err;
  30. end;
  31. end.