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

Sven Barth pascaldragon at googlemail.com
Mon Mar 11 17:14:22 CET 2019


Anton Shepelev <anton.txt at gmail.com> schrieb am Mo., 11. März 2019, 15:12:

> Sven Barth to Anton Shepelev:
>
> >>Since we already have cross-platform functions FileRead
> >>and FileWrite, would not it be useful to have them set the
> >>InOutRes variable, or to publish a facility for converting
> >>the value of GetLastOSError into an InOutRes value?
> >
> >The usage of InOutRes is only defined for the Pascal style
> >file I/O (Read/Write).
>
> Thanks for the correction.  My second propostion, however,
> still holds.  Writers of drivers for this Pascal-style I/O
> interface should have the ability to convert OS-specific
> error codes into InOurRes values, which are not even
> documented at:
>
>    https://www.freepascal.org/docs-html/rtl/system/inoutres.html


You're not supposed to use InOutRes directly to read it (that should
probably be added to its documentation) , but instead IOResult needs to be
used. And *there* the values are documented:
https://www.freepascal.org/docs-html/rtl/system/ioresult.html

Notice also that FreePascal's TextRec handling is
> incompatible with that of Delphi.  The TextRec operations
> OpenFunc, InOutFunc, FlushFunc, and CloseFunc return a
> longint, which Delphi interprets as the result code but
> FreePascal ignores.  Therefore, I must set InOutRes in
> FreePascal and return the error in Delphi.
>

Now *that* is something that can and probably also should be talked about.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190311/004045ac/attachment.html>


More information about the fpc-devel mailing list