On Sat, 15 Oct 2022, Hairy Pixels via fpc-pascal wrote:
How can I iterate over the pointer that is returned from GetDynArrayProp? I
tried to cast it as a dynamic array of the element type but calling Length() on
the returned value gave garbled data.
For example with a property of the type “array of TObject":
type
TObjectArray = array of TObject;
PObjectArray = ^TObjectArray;
var
ObjectArray: PObjectArray;
begin
ObjectArray := PObjectArray(GetDynArrayProp(AObject, PropertyInfo));
as far as I kbow, this should be
ObjectArray := TObjectArray(GetDynArrayProp(AObject, PropertyInfo));
i.e. you get the actual array as a result.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal