What? can you be a bit more specific on what you want to do?
Do you want to enable RTTI for your classes?
In this case take a look on {$M+} or inherit your classes from TPersistent.
Do you want to use RTTI to write extra functionality?
In this case take a look on the unit typinfo and the RTTI Controls Package that's included with lazarus.
I know that.
It's about how RTTI functions are created
For example, how do you know that the function:
Function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string) : PPropInfo;
var
hp : PTypeData;
i : longint;
p : shortstring;
pd : ^TPropData;
begin
P:=PropName; // avoid Ansi<->short conversion in a loop
while Assigned(TypeInfo) do
begin
// skip the name
hp:=GetTypeData(Typeinfo);
// the class info rtti the property rtti follows immediatly
pd:=aligntoptr(pointer(pointer(@hp^.UnitName)+Length(hp^.UnitName)+1));
Result:=PPropInfo(@pd^.PropList);
for i:=1 to pd^.PropCount do
begin
// found a property of that name ?
if ShortCompareText(Result^.Name, P) = 0 then
exit;
// skip to next property
Result:=PPropInfo(aligntoptr(pointer(@Result^.Name)+byte(Result^.Name[0])+1));
end;
// parent class
Typeinfo:=hp^.ParentInfo;
end;
Result:=Nil;
end;
It has to look like this
To put it as simple as I can, RTTI is a record that contains information about the class in question.
The record is defined inside the compiler and can not be extended by the end user.
You can find out the record's definition by ctrl+click on the PTypeInfo, TPropData etc data types to jump to their declarations. Ppressing F1 on the name of the type (and if the help system manages to function properly) you will see the documentation on the types.
Now most of the RTTI functions are nothing more than using the information about the type to decide how to do what ever they need to do.
With out a specific goal in mind there is no way to explain how to use it or why.
Take a closer look on Get/Set PropValue() for an overview.