Remove classes string name from compiled release e

2019-03-04 07:43发布

问题:

I compile the release version of my application project. When I look with binary editor my compiled final exe i can see all the class name of my own created object, for example : TPolygon, TRectangle, etc..., as binary text data inside the exe.

How i can remove this information from exe. I try to remove disabling RTTI using in dpr:

{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}

But not luck, any hints.

回答1:

If you were to remove class names from the executable, then your application would stop working. The .dfm files that are compiled into your application contain the class names. The runtime streaming framework needs to be able to look those classes up in the class registry and without the names then your forms and their properties could not be streamed.

On top of that, as AlexSC points out, the implementation of TObject.ClassName requires the names of the classes to be present in the executable file.