[fpc-pascal] uses in 'filename'
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Feb 22 15:25:49 CET 2018
On Thu, 22 Feb 2018 12:48:21 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:
>[...]
> First of all, normally it won't work either way, because you must use "unit foo;" and "unit bar;" in the files.
No, I can use normal units. This works here:
---test1.pas---
uses foo in 'unit1.pas', unit1, bar in 'sub/unit1.pas';
Begin
i:=3; // from unit1.pas
foo.i:=foo.i+1; // from unit1.pas
bar.j:=27; // from sub/unit1.pas
writeln(foo.i,' ',unit1.i,' ',bar.j);
end.
---
---unit1.pas---
unit unit1;
interface
uses foo in 'sub/unit1.pas'; // unit1 uses another unit1
var i: integer;
implementation
end.
---
---sub/unit1.pas---
unit unit1;
interface
var j: integer;
implementation
end.
---
Mattias
More information about the fpc-pascal
mailing list