If the pointer points to a variant, then its type is PVariant. Add it to this, and then look for:
Result := PVariant(FAddress)^;
Better yet, declare FAddress
with the correct type to start, and then you don't need to infer the type:
var FAddress: PVariant; Result := FAddress^;
The compiler considers your type attempts to be invalid because Variant is a larger type than a pointer. The compiler does not know where to get additional data to create the full Variant value. And if the cast type was valid, the use of the ^
operator is in any case not allowed on Variant. You may have dealt with this:
Result := Variant(FAddress^);
I never liked it; if FAddress is an untyped pointer, then dereferencing it gives a value without any size or type at all, and it is just weird to print such things.
source share