[fpc-pascal] Delphi mode syntax error

Roland Turcan konf at rotursoft.sk
Tue Jan 19 11:14:16 CET 2010


Hello all,

I use Delphi style of programing in Lazarus to keep a compatibility
with Kylix and therefore I want to get this code which is valid of
Freepascal's ObjectPascal, but in {$MODE Delphi} it doesn't accept
calling of "MyItems[index]" and writes "Array type required".

How to adapt this code to be valid for Delphi mode.

TYPE
  PtrUInt = DWord;
  TMyObj  = PtrUInt;
  PMyObj  = ^TMyObj;
  TArr    = ARRAY OF TMyObj;

procedure TForm1.FormCreate(Sender: TObject);
VAR MyItems         :PMyObj;
    Arr             :TArr;
begin
  SetLength (Arr, 5);
  Arr[0] := 1;
  Arr[1] := 2;
  Arr[2] := 3;
  Arr[3] := 4;
  Arr[4] := 5;

  MyItems := Pointer (Arr);

  ShowMessage (IntToStr (MyItems[0]));
end;


Thanks.

-- 
Best regards, TRoland
http://www.rotursoft.sk
http://exekutor.rotursoft.sk




More information about the fpc-pascal mailing list