I am using a FindFile routine to search through all files in a directory. The original code was freely available from Latium Software. It runs the FindFile is a separate Thread.
It has always worked fine, and still continues to work fine. But since I upgraded from Delphi 4 to Delphi 2009, it now gives a Warning:
W1055: Published caused RTTI ($M+) to be added to type '%s' (Delphi)
The error occurs at the “published” line of this thread declaration:
TThread1 = class(TThread)
private
OwnerForm: TFindFileForm;
procedure Initialize;
procedure AddFileName;
procedure Finalize;
protected
procedure Execute; override;
published
constructor Create(Owner: TFindFileForm);
destructor Destroy; override;
end;
The Delphi help states:
You added a ‘PUBLISHED’ section to a class that was not compiled while
the {$M+}/{$TYPEINFO ON} switch was in
effect, or without deriving from a
class compiled with the
{$M+}/{$TYPEINFO ON} switch in effect.The TypeInfo standard procedure requires a type identifier as its
parameter. In the code above,
‘NotType’ does not represent a type
identifier.To avoid this error, ensure that you compile while the {$M+}/{$TYPEINFO
ON} switch is on, or derive from a
class that was compiled with
{$M+}/{$TYPEINFO ON} switch on.
Well, I didn’t add the ‘PUBLISHED’ section. It’s always been there. I’m not a component developer, and I really don’t understand at all what this message means, whether or not it is really a problem, and what I should or should not do about it.
Is this important and if so, what should I do to fix it? Or should I just ignore it?
It adds some data to the executable and increases its size somewhat. In very rare cases it can be a reverse engineering risk, as it permits third parties (e.g. crackers) to see that the class supports the methods mentioned in the published section.
You can safely ignore it, or replace the
publisheddirective withpublicto make it go away.