Hello,
I have such a basic problem in Delphi,I can't solve it.
My Code:
Note:DataR is local in the methods below,but usually it's a class var.Just for the concept it's local.
class procedure TCelebrity.BeginRead(var input:Array of byte);
var DataR:Array of byte;
begin
VirtualFree(@DataRead,High(DataRead),MEM_RELEASE);
SetLength(DataR,Length(input));
Move(input,DataR,Length(input));
end;
This compiles,but after Move() is executed DataR = nil.
Second try:
class procedure TCelebrity.BeginRead(var input:Array of byte);
var DataR:Array of byte;
begin
VirtualFree(@DataRead,High(DataRead),MEM_RELEASE);
SetLength(DataR,Length(input));
DataR := Copy(input,0,Length(input));
end;
This doesn't compile at all.Error at the third line(DataR := Copy(input....) saying "Incompatible types".
Where's the problem? They are all Array of byte!