[fpc-pascal] How do I take the float type of a field from a record?

silvioprog silvioprog at gmail.com
Fri Dec 14 07:44:30 CET 2018


Oh, please ignore and sorry for noise. I found the solution as soon as I
sent the e-mail. -.-

var
  F: PManagedField;
  R: TTestRecord;
  T, T2: PTypeData;
  I: Integer;
begin
  R := Default(TTestRecord);
  T := GetTypeData(TypeInfo(R));
  F := PManagedField(PByte(@T^.TotalFieldCount) + 4);
  for I := 0 to Pred(T^.TotalFieldCount) do
  begin
    if F^.TypeRef^.Kind = tkFloat then
    begin
      T2 := GetTypeData(F^.TypeRef);
      WriteLn(F^.TypeRef^.Kind, ':', T2^.FloatType);
    end;
    Inc(F);
  end;
end;

time to go to bed.

-- 
Silvio Cl├ęcio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181214/a4dbfc3e/attachment.html>


More information about the fpc-pascal mailing list