Hi, I am trying to convert some DOS Modula-2 programs I wrote in the 90's with the Topspeed M2 Compiler.
Running PC-Linux, and using Lazarus with the crt library for the applications and libraries.
I have added a few lines from the crt library to a simple example programme which compiles Ok.
But I tried adding a procedure to an example library and it fails to compile with the following message.
Compile project1 Target: libproject1.so: Exit code1, Errors: 1
Project1.pas(31.3) Fatal: Syntax error, "BEGIN" expected but "identifier COLORS" found
library subs;
uses
crt; // crt added to example.
procedure Colors( FgCol, BgCol : Byte ); // Added this procedure
begin
TextColor( FgCol );
TextBackground( BgCol );
end;
function SubStr(CString: PChar;FromPos,ToPos: Longint): PChar; cdecl; // Existing example follows.
// This is an copied example,
var
Length: Integer;
begin
Length := StrLen(CString);
SubStr := CString + Length;
if (FromPos > 0) and (ToPos >= FromPos) then
begin
if Length >= FromPos then
SubStr := CString + FromPos;
if Length > ToPos then
CString[ToPos+1] := #0;
end;
end;
project1
exports
SubStr;
Colors;
end.
I don't understand why this fails, but if armed with a simple working library I think I can make some progress towards converting the first program.