I define some class in file unitbug.hhf

type
PMyClass: pointer to TMyClass;
TMyClass: class;
procedure TstProc(Param: PMyClass); @external;
procedure TstProc1; @external;
endclass;

the implemetation of this class in file unitbug.hla:
readonly
VMT(TMyClass);


procedure TMyClass.TstProc (Param: PMyClass);
@nodisplay; @nostackalign;
var
Loc: PMyClass;
begin TstProc;
// Param.TstProc1();
Loc.TstProc1();
end TstProc;

procedure TMyClass.TstProc1;
@nodisplay; @nostackalign;
begin TstProc1;
mov(&lbl_tst,eax);
lbl_tst:
end TstProc1;

if i remove a comment then during compilation of this i have an exception in hlaparse.exe:
Memory can not be read
but with local variable it compiles without exceptions
Posted on 2003-10-21 08:16:44 by Elohim Meth

if i remove a comment then during compilation of this i have an exception in hlaparse.exe:
Memory can not be read
but with local variable it compiles without exceptions


Interestingly enough, I've been tracking down this bug with the help of someone on the HLA/AoA mailing list for the past week and just discovered the problem before reading this post. It is bad code generation. Another work-around is to use a pointer to the class. The problem appears to be when you put the variable in a static section. This will be fixed for the v1.59 release.
Cheers,
Randy Hyde
Posted on 2003-10-21 10:09:52 by rhyde
Thank you for reply Mr.Randall
Posted on 2003-10-21 10:26:03 by Elohim Meth