[fpc-pascal] Syntax problem with first unit
Francisco Reyes
lists at stringsutils.com
Sun Apr 5 05:25:57 CEST 2009
Trying my first unit and getting an error I can't figure out.
--- unit
unit debugprint;
Interface
function DebugPrint(ProgLevel, CallLevel:integer; MessageIn: string):string;
Implementation
function DebugPrint(ProgLevel, CallLevel:integer; MessageIn: string):string;
begin
if ProgLevel>= CallLevel then
DebugPrint := MessageIn ;
end;
end.
--- Program to test unit
program tdp;
uses debugprint;
var
Msg: string;
begin
writeln ('hello world');
Msg := DebugPrint(0,1,'Debug message');
writeln(Msg);
end.
------
Getting an error
tdp.pas(9,18) Fatal: Syntax error, "." expected but "(" found
Line 9 is the call to the function in the unit.
If I take the function and move it from the unit to the main
program it works fine.
Any pointers greatly appreciated.
More information about the fpc-pascal
mailing list