[fpc-pascal] Serial unit for Linux and Windows

Tomas Hajny XHajT03 at mbox.vol.cz
Thu Apr 10 03:37:23 CEST 2008


On Thu, April 10, 2008 01:11, Stephano wrote:
 .
 .
> 4- Windows SerOpen function (based on CreateFile) returns an
> INVALID_HANDLE_VALUE if the device could not be found. How to unify for
> both Linux & Windows? Is it safe to return instead -1 (as in the Linux
> case)?
 .
 .

If I read the Windows unit sources correctly, INVALID_HANDLE_VALUE = -1
too. However, I believe that you might consider returning UnusedHandle
constant defined in System unit for all the platforms (that's -1 for at
least most of them anyway, but I believe that it may be still better from
portability point of view to refer to it using this constant).

Tomas





More information about the fpc-pascal mailing list