initc.pp 962 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. uses
  14. ctypes;
  15. function fpgetCerrno:cint;
  16. procedure fpsetCerrno(err:cint);
  17. property cerrno:cint read fpgetCerrno write fpsetcerrno;
  18. implementation
  19. const clib = 'libc';
  20. function geterrnolocation: pcint; cdecl;external clib name '___errno';
  21. function fpgetCerrno:cint;
  22. begin
  23. fpgetCerrno:=geterrnolocation^;
  24. end;
  25. procedure fpsetCerrno(err:cint);
  26. begin
  27. geterrnolocation^:=err;
  28. end;
  29. end.