[fpc-devel] IO checks across packages

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Jul 25 15:19:13 CEST 2011


On 25 Jul 2011, at 15:07, Martin wrote:

> If some packages are compiled with and some without IO checking. An IO error happens in a package that is compiled without IO checking, as expected no error is risen here. But the error is stored, and an unrelated statement which has IO checks will fail later.
> 
> The following demo project enables and disables IO checks to simulate the situation.
> 
> program Project1;
> {$mode objfpc}{$H+}
> begin
>  {$I+}
>  writeln('1');
>  {$I-}
>  chdir('c:\IDoNotExist');
>  {$I+}
>  writeln('2');  // error for chdir is risen here
>  readln;
> end.

That is normal. If you disable iochecks, you're supposed to call ioresult to check for errors (which will in turn reset any stored error conditions).


Jonas


More information about the fpc-devel mailing list