[fpc-pascal] Any way to find all descendants of a class?

Sven Barth pascaldragon at googlemail.com
Thu Mar 1 07:58:07 CET 2012

Am 29.02.2012 19:58, schrieb Craig Peterson:
> In Delphi I can use the new extended RTTI support to build a list of all
> TForm descendants in my application (TRttiContext.GetTypes).  Is there
> any way to do the same thing in Free Pascal without having to explicitly
> add each class to a list?

Free Pascal does not yet support the extended RTTI, so the answer is: No.

> I do have an intermediate class that all of our other forms descend
> from, so I can add something there if necessary, and I don't need it to
> be compatible with Delphi.

In theory all classes that can be read from e.g. an LFM file are 
registered with the RTL's streaming system. So please check whether the 
corresponding functions can help you. You can find them in 
$fpcdir/rtl/objpas/classes/classesh.inc around line 1938 (look for 


More information about the fpc-pascal mailing list