[fpc-pascal] uses myunit in '../src/myunit.pas' ?

Michael Van Canneyt michael at freepascal.org
Mon Feb 13 15:18:27 CET 2017



>>> But thinking that the compiler itself will automagically determine the
>>> path: that's simply not realistic.
>
>> Really ?
>
>> When the compiler reads uses section and find a "in" like here :
>
>> uses myunit in '/thepath/src/myunit.pas';
>
>> He could do something like:
>> ...
>> if fpcword = 'in' then begin
>> IncludeSearchPath((ExtractFilePath('/thepath/src/myunit.pas'); // this
>> added
>> ...
>> IncludeUnit('/thepath/src/myunit.pas');

The compiler already does this.

-----------------------------------
cadwal: >cat p.pp 
program p;

uses unita in 'Documents/unita.pp';

begin
end.

cadwal: >cat Documents/unita.pp
unit unita;

interface

implementation

end.

cadwal: >fpc p.pp
cadwal: >
-----------------------------------

But honestly: you're much better off using fpmake or lazarus packages.

The 'in' construct was/is a serious contender for "the worst idea ever" of Borland.

Michael.


More information about the fpc-pascal mailing list