Is there a way to convert 'array of const' (open array) to TValue?
Is there a way to convert 'array of const' (open array) to TValue?
For example, I want to call SysUtils.Format function using System.RTTI.Invoke which requires function arguments to be passed as TArray.
I tried
type
TVArray = array of TVarRec;
...
a[1] := TValue.FromArray(TypeInfo(TVArray), [TValue.From(100)]);
System.Rtti.Invoke(@format, a, ccReg, TypeInfo(string));
but it leads to 'Invalid class typecast' when convering array values inside Invoke.
For example, I want to call SysUtils.Format function using System.RTTI.Invoke which requires function arguments to be passed as TArray
I tried
type
TVArray = array of TVarRec;
...
a[1] := TValue.FromArray(TypeInfo(TVArray), [TValue.From
System.Rtti.Invoke(@format, a, ccReg, TypeInfo(string));
but it leads to 'Invalid class typecast' when convering array values inside Invoke.
Attila Kovacs It's friday, falling asleep watching asm is allowed :D
ReplyDeleteAsbjørn Heid
ReplyDeleteThank you, exactly what I needed.
/sub
ReplyDelete