[lazarus] objpas and linux

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri May 14 05:22:20 EDT 1999




On Thu, 13 May 1999, Peter Vreman wrote:

> 
> Please don't use the objpas unit directly in the uses clause. Please put a 
> 
> {$mode objfpc}
> 
> in top of the file.
> 
> New compiler snapshots (starting tomorrow) will issue a warning.
> 
> 
> Also use the common pascal way to read a file instead of fdopen/fdread, so
> it can also be compiled for win32. If the linux unit is really need place
> it atleast between a {$ifdef linux}

Better yet:

FOR ALL LOW-LEVEL FILE/DISK/DATE STUFF, use the sysutils unit.
It is 100% Delphi compatible, and exists on all platforms.

The reason FCL compiles on all platforms is because it uses the sysutils unit
only !

In concreto:

fdOPen -> FileOpen/FileCreate
fdRead -> FileRead
fdWrite -> FileWrite
fdSeek -> FileSeek
fdTruncate -> FileTruncate

It also has many file-name handling functions:
 ExtractFileName
 ExtractFileExt
 ExtractFilePath
 ExtractFileDir
 ExtractRelativePath (NOt in Delphi)
Which autmatically take care of / or \ issues and the like.

Using the sysutils unit for low-level stuff makes porting more easier.

Michael.






More information about the Lazarus mailing list