I get an access violation when I try to run my program with 'Optimization'
enabled.
I use D7 with update 1.
Anybody can explain why?
Also Delphi can't stop the program (Control+F2) at that point. Debuger act
strange sometimes.
Final solution is to close Delphi.
In some cases it doesn't want to close so I have to Ctrl+Alt+Del it.
function TScfObj.ReadSCF_Header: boolean;
VAR i: Integer;
begin
Reset(FFile, 1);
H.MagicNumber := LowerCase(ReadString(@FFile, 4));
H.SamplesNr := RReadUInt4(@FFile);
...
for i:= 0 to 17 DO H.spare[i]:= RReadUInt4(@FFile); <--- ERROR (AV) HERE
!!!!!!
...
end;
The AV apear AFTER calling first time RReadUInt4 in FOR loop.
function RReadUInt4(my_fp: TFilePtr): Cardinal;
{ SWAP READ }
begin
{ Seek (F, ?)}
BlockRead(my_fp^, Result, 4);
SwapCardinal(Result);
end;
Procedure SwapCardinal(Var LongVar: Cardinal); {Swap32bits unsigned integer}
Asm
mov esi,longvar
xor eax,eax
mov ax,[esi]
xor edx,edx
mov dx,[esi+2]
mov [esi],dh
mov [esi+1],dl
mov [esi+2],ah
mov [esi+3],al
End;
type
TScfObj = class(TObject)
private
FFile: FILE;
...
end;
...and the traveler died, stroked by the beauty of the landscape.
THE MORNING OF THE MAGICIANS
Louis Pawels & Jacques Bergier
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk