[fpc-devel]Incomatibility: Include files directory ordering

Peter Vreman peter at freepascal.org
Fri Apr 11 13:31:16 CEST 2003


> Hello everybody!
>
> For some time now I have noticed a small incompatibility between FPC and
> BP(7) about the loading of include files. I am currently using FPC 1.0.4
> so if this is already resolved in a more recent version please drop me a
> note and excuse me bothering you with that.
>
> This different behaviour leads for me to a slight inconvenience, so I
> could live with it, but is different to BP7 and as FPC tries to be fully
> compatible this may be of interest.
>
> It is about the ordering of the include files directories. In BP the
> current directory is searched first, probably next is the directory
> where the compiled file is located (I haven't verified this so please
> check if you want to be shure, may be this has to be given explicitly)
> and then the specified additional directories are checked. In FPC the
> directory where the compiled file is located is checked ALLWAYS FIRST, I
> have found no switch or option to change this and this makes me some
> trouble now.
>
> But besides that, from the logical view the BP approach seems to be
> better - if you use an include file for some settings (compiler defines,
> variables etc.) and compile your project in a different directory than
> some common used files (e.g. Units), the units may be compiled with
> wrong settings (as long as local files are present at the units
> location, let's say for test purpose when these units were originally
> written).
>
> I don't know if maybe now someone depends on the new include directory
> ordering which would be broken if this is reverted to the BP scheme, but
> at least a compiler flag may be introduced (or to be implicitly in -So
> which for 1.0.4 is not).
>
> From historical view, I had noticed that at some 0.9x release of FPC but
> at this point it was not important. Now when I try to migrate my
> projects to FPC this difference is noticed well.

FPC is compatible with Delphi/Kylix. I don't have tp7 installed here to
test. But the test i did was:

./p.inc
writeln('hallo');

./pp/p.pp
begin
  {$i p.inc}
end.

./pp/p.inc
writeln('hello');

And then compile ./pp/p.pp, the output of the generated executable was
'hello'

IMHO is not good to make differences in behaviour in which order FPC will
find files. The -S is for Syntax/Semantics within the sources and not how
and where it will find files.





More information about the fpc-devel mailing list