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. _______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to