title: FPC : RTTI on records
body: <p>This is my first time on this site. Usually, I have no problem to found replies in the old posts but I don't success with my actual problem.</p>
  
  <p>I would like to know how use RTTI functions to know at running time the properties/members of a record under Lazarus/FPC? I know how to do it for a class (Tpersistent descendant and published properties) but not for FPC. Some links indicates how to do it under Delphi (From D2010), but I don't know how to transpose it under Lazarus. </p>
  
  <p>Thanks in advance for help and assistance.
  Salim Larhrib.</p>
  
  <p>To kevin : As I told before, this is my first demand. But I understand. You are right. This is my  code </p>
  
  <pre><code>procedure TMainForm.btRecordTHashListClick(Sender: TObject);
  var
    pTData    : PTypeData;
    pTInfo    : PTypeInfo;
    TablePtr  : PatableRecord;
    Loop      : Integer;
  begin
    // Set of Record pointers + HashList
  
    // Create Container
    if  not Assigned(FTableRecList) then FTableRecList := TFPHashList.Create;
  
    // Insert data
    new(TablePtr);
    TablePtr^.description := 'Dictionnaire des tables.';
    FTableRecList.add('atable', TablePtr );
  
    new(TablePtr);
    TablePtr^.description := 'Dictionnaire des fonctions.';
    FTableRecList.add('afunction', TablePtr );
  
    new(TablePtr);
    TablePtr^.description := 'Dictionnaire des listes d''option.';
    FTableRecList.add('alist', TablePtr );
  
    // Read records
    for Loop:=0 to FTableRecList.Count-1 do
    begin
      TablePtr := FTableRecList[Loop];
      ShowMessage('Parcours Index : ' + TablePtr^.description);
    end;
  
    // Find records
    try
      TablePtr := FTableRecList.Find('ddafunction');
      ShowMessage('Record finded : ' + TablePtr^.description);
    except
      ShowMessage('Not such record .');
    end;
    try
      TablePtr := FTableRecList.Find('afunction');
      ShowMessage('Record finded : ' + TablePtr^.description);
    except
      ShowMessage('No such record.');
    end;
  
    // Free memory : To put later in TFPHashList wrapper
    for Loop:=0 to FTableRecList.Count-1 do Dispose(PatableRecord(FTableRecList[Loop]));
  
  // RTTI
    pTInfo := TypeInfo(TatableRecord);
  
    pTData := GetTypeData(pTInfo);
    ShowMessage('Member count = '+IntToStr(pTData^.PropCount));
  end;
  </code></pre>