delphi - Is there any way to get RTTI hints for a real48 and shortstring variable in a structure where FieldType is nil in TRttiField? -
i have discovered think odd oversight (probably intentional) on part of extended rtti feature in delphi.
i dump fields in record type has 1500 different fields in it. yes, seriously.
some of them of type real48 , shortstring, two, appears fieldtype nil these types @ runtime:
function trttifield.getvalue(instance: pointer): tvalue; var ft: trttitype; begin ft := fieldtype; if ft = nil raise insufficientrtti; // fires! tvalue.make(pbyte(instance) + offset, ft.handle, result); end;
if willing assume nil-fieldtype fields in fact real48's, use offset , (if field width 6) grab real48 value.
however second complication shortstring (ie string[30]
) types afflicted.
has got these 2 ancient pascal types work modern extended rtti? right i'm using best-guess approach, , fails hardcoding rules name of field, if there technique use me there without having write lot of code extract information these old pascal file-of-records modernizing, appreciate better idea.
unfortunately real48 not have type info.
you can see when try compile this:
program project1; begin typeinfo(real48); end.
the same goes string[n] syntax. there fix defining own string types like:
type string30 = string[30];
that alone not include rtti record field need hack/fix rtti showed here: https://stackoverflow.com/a/12687747/587106
Comments
Post a Comment