[lazarus]

Marc Weustink weus at quicknet.nl
Sun Oct 31 17:59:53 EST 1999


Hi
Am I missing something? When I try the following, I get an runtime error:
  enter WriteRect
  pointer $0806EC18 does not point to valid memory block

It seems that you can't reference the variable whose adress is passed as a
pointer.

Since we use this contruction a lot, I get errors at the most unexpecting
places.

Marc

-------------------------------------------
program test2;

uses
  Classes, SysUtils;

type
  PRect = ^TRect;
  
procedure WriteRect(p: pointer);
begin
  WriteLN('enter WriteRect');
  PRect(p)^.Left := PRect(p)^.Left + 1;
  WriteLN(Format('%d, %d, %d,%d', 
   [PRect(p)^.Left, PRect(p)^.Top, PRect(p)^.Right, PRect(p)^.Bottom]));
end;

var
  R: TRect;
begin
  R.Left := 0;
  R.Top := 10;
  R.Left := 20;
  R.Bottom := 30;
  WriteRect(@R);
end.







More information about the Lazarus mailing list