mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 10:11:27 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
| {
 | |
|     This file is part of the Free Pascal run time library.
 | |
|     Copyright (c) 1999-2004 by the Free Pascal development team.
 | |
| 
 | |
|     This file handles the libc errno abstraction.
 | |
| 
 | |
|     See the file COPYING.FPC, included in this distribution,
 | |
|     for details about the copyright.
 | |
| 
 | |
|     This program is distributed in the hope that it will be useful,
 | |
|     but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 | |
| 
 | |
|  **********************************************************************}
 | |
| {$IFNDEF FPC_DOTTEDUNITS}
 | |
| unit initc;
 | |
| {$ENDIF FPC_DOTTEDUNITS}
 | |
| 
 | |
| interface
 | |
| {$IFDEF FPC_DOTTEDUNITS}
 | |
| uses
 | |
|   System.CTypes;
 | |
| {$ELSE FPC_DOTTEDUNITS}
 | |
| uses
 | |
|   ctypes;
 | |
| {$ENDIF FPC_DOTTEDUNITS}
 | |
| 
 | |
| function fpgetCerrno:cint;
 | |
| procedure fpsetCerrno(err:cint);
 | |
| 
 | |
| property cerrno:cint read fpgetCerrno write fpsetcerrno;
 | |
| 
 | |
| implementation
 | |
| 
 | |
| const clib = 'libc';
 | |
| 
 | |
| function geterrnolocation: pcint; cdecl;external clib name '___errno';
 | |
| 
 | |
| function fpgetCerrno:cint;
 | |
| 
 | |
| begin
 | |
|   fpgetCerrno:=geterrnolocation^;
 | |
| end;
 | |
| 
 | |
| procedure fpsetCerrno(err:cint);
 | |
| begin
 | |
|   geterrnolocation^:=err;
 | |
| end;
 | |
| 
 | |
| 
 | |
| end.
 | 
