[fpc-devel] TObject differences between fpc and delphi

Paul Ishenin webpirat at mail.ru
Wed Oct 28 15:44:13 CET 2009


Paul Ishenin wrote:
> I am trying to get UnitName from the RTTI but have some problems:
> ...
> Few questions now:
> a) Why TypeInfo(TObject) <> TObject.ClassInfo?
> b) Why TypeInfo(TPersistent) = TPersistent.ClassInfo?
No idea why but it is the same in delphi < d2010. Probably in d2010 it 
depends on project rtti settings. And UnitName = '' in d2009 for classes 
with no RTTI.

> c) How to get TypeInfo of the class inside that class class method?
Probably no way except the using the same info which ClassType using.
> So what is the best way to implement this UnitName method?
Still the question. Using RTTI and return empty result if it does not 
exists or changing the compiler to write unit name near the class name?

Best regards,
Paul Ishenin.



More information about the fpc-devel mailing list