Question closed (answer accepted) replaced by http://stackoverflow.com/questions/3157732/delphi-7-access-violation-tbytedynarray-problem)
I have the following delcartion given to me
MyPhoto = class(TRemotable)
private
FhasPhoto: Boolean;
FphotoData: TByteDynArray;
published
property hasPhoto: Boolean read FhasPhoto write FhasPhoto;
property photoData: TByteDynArray read FphotoData write FphotoData;
end;
and I want to
var photo : MyPhoto;
photo := MyPhoto.Create();
SetLength(photo.photoData, 4);
but I get
[Error] mainForm.pas(340): Constant object cannot be passed as var parameter
1) How do I code it correctly, given that I can't change the definition of the class Photo?
2) can I effectively 'cast' any structure to a TByteDynArray just by assigning it?
(as you might have guessed, I'm a BCB guy trying to get into Ddlphi :-)
p.s I will settle for being able to assign each byte of the photo data individually...