<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2800.1543" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#c0c0c0>
<DIV><FONT face=Arial size=2>helllo!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Variable V is variant type, <BR>in first step V
must be array type (V := VarArrayCreate)<BR>in second step type
varBYte.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>In delphi and lazarus everything is
ok.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>in fpc 2.0.2 (linux) program show
error EVariantInvalidOpError.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>See example below.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>where is error?</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>=================</DIV>
<DIV> </DIV>
<DIV><BR>example:</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>var v : variant;<BR>
v2 : variant;<BR> p_wart :
variant;<BR>Type Tarr = array[0..2] of word;<BR>var p :
^Tarr;<BR>begin<BR> V := VarArrayCreate( [0,2], varword);<BR> p :=
VarArrayLock(V);<BR> try<BR>
writeln('0');<BR> p^[0] := word(11);<BR>
writeln('1');<BR> P^[1] := word(22);<BR>
writeln('2');<BR> p^[2] := word(33);<BR>
writeln('3');<BR> finally<BR> p_wart :=
V;<BR> VarArrayUnlock(V);<BR>
VarClear(V);<BR> end;</DIV>
<DIV> </DIV>
<DIV> writeln('p[1]=', p_wart[1]);<BR> try<BR> if
VarIsArray(V) then writeln('V is array');<BR> V :=
Unassigned;<BR> <BR> V2 :=
Byte(0);<BR> writeln('4'); // ok
!<BR> V :=
V2; // <-- An unhandled
exception occurred at $080645C6 :<BR>
writeln('5'); // EVariantInvalidOpError : Invalid
variant operation</DIV>
<DIV> </DIV>
<DIV> V := Byte(2);<BR>
writeln('6');<BR> p_wart := V;<BR>
writeln('7');<BR> except<BR> on E: Exception do
Writeln(E.Message, ', nr=',E.HelpContext);<BR> end;</DIV>
<DIV> </DIV>
<DIV> readln;</DIV>
<DIV> </DIV>
<DIV><BR> </DIV></FONT></BODY></HTML>