[fpc-pascal] Requirement of {$M+} to add RTTI info

luiz americo pereira camara luizmed at oi.com.br
Wed Dec 12 01:14:51 CET 2012


Some time ago, i was getting an error while trying to use RTTI
functions in a class descending directly of TObject

Later i discovered that i needed to descend from TPersistent due to
$M+ directive (http://www.freepascal.org/docs-html/prog/progsu44.html),
so i did.

Now, i decided to go back and descend directly from TObject. To allow
RTTI usage i would put M+ around my own class

I tested again and using RTTI functions (SetOrdProp, GetPropInfo)
worked even without declaring {$M+}

So, is it really necessary to put $M+ to use RTTI?

Luiz



More information about the fpc-pascal mailing list