Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

LogObject troubles


Hi there,

I’m having trouble logging objects that I build myself. The SmartInspect console keeps telling me ‘LogObject: AInstance argument has no RTTI’. I do have published properties in the objects in question (As I understand it RTTI information is only available for published properties), but to no avail.

Any thoughts?

Gerben ten Wolde,

Ten Hove ICT



Additionally to making the properties published you have to inherit from the TPersistent class to get RTTI data associated with a class in Delphi. Just adding TPersistent as the base class should do the trick. Hope that helps!


Thanks, that solved it.


Another way to add the RTTI information is by using the $M compiler directive.

Taken from the Delphi 7 help file:

A class cannot have published members unless it is compiled in the {$M+} state or descends from a class compiled in the {$M+} state. Most classes with published members derive from TPersistent, which is compiled in the {$M+} state, so it is seldom necessary to use the $M directive.


unit uSomeObject;




TSomeObject = class(TObject)
{ Private Declarations }
procedure SetCaption(AValue: string);
function GetCaption: string;
{ ProtectedDeclarations }
{ Public Declarations }
property Caption: string read GetCaption write SetCaption;
{ Published Declarations }

For more information see the topic “Published members” in the Delphi 7 help file.


Well, bummer. The forum doesn’t allow leading spaces. Also my example has a mistake. {M+} should have been {$M+}