Ok, I got it wrong with my previous question about enumerations, but what about this:
(file babyunit2)
unit babyunit2;
interface
type MyType = (a,b,c);
implementation
end.
(file babyunit)
unit babyunit;
interface uses babyunit2;
procedure printmytype(b : mytype);
implementation
procedure printmytype(b : mytype); begin writeln(ord(b)); end;
end.
(file baby)
program baby;
uses babyunit,babyunit2;
var x : mytype;
begin for x:=a to c do printmytype(x); end.
[root@twentyfour aargh]# gpc -g -c -w babyunit2.pas [root@twentyfour aargh]# gpc -g -c -w babyunit.pas [root@twentyfour aargh]# gpc baby.pas babyunit2.o babyunit.o -o baby baby.pas: In function `program_Baby': baby.pas:19: incompatible type for argument 1 of `Printmytype'
However, when I combine all three files like this:
program baby;
type MyType = (a,b,c);
procedure printmytype(b : mytype); begin writeln(ord(b)); end;
var x : mytype;
begin for x:=a to c do printmytype(x); end.
Everything works fine. Surely this has to be a compiler problem?