[fpc-devel] Publish some of FPC's internal cross-platform functionality

Michael Van Canneyt michael at freepascal.org
Sat Mar 9 18:32:38 CET 2019



On Sat, 9 Mar 2019, Anton Shepelev wrote:

> Hello, all
>
> FreePascal has many low-level cross-platform functions
> scattered over multiple .inc files but not consolilated into
> reusable cross-platform units.  Consider, for example, the
> functions
>
>  function do_read (h: longint; addr: pointer; len: longint) : longint;
>  function do_write(h: longint; addr: pointer; len: longint) : longint;
>
> implemented in sysfile.inc for Unix, Winows, Mac OS, MS-DOS,
> and other operatring systems.  Wouldn't it be useful to
> publish them in a unit sysfile.pp, possibly along with a
> facility to translate the OS-specific error codes into a
> general enumeration?
>
> It would relieve the programmer of writing conditionally
> compiled OS-specific code sections for such basic operations
> as are already implemented in FreePascal's internals.  I,
> for example, have to do it whenever my Windws/Unix program
> works with a file handle.

I don't think we should publish this, it forces us to maintain this
interface.

I also don't see why you need this. 
You have this functionality available in a cross-platform manner
in THandleStream, or the sysutils functions.

Michael.



More information about the fpc-devel mailing list