今日见到的,虽然未用上D2010不过先记录下来。
扩充的RTTI信息将使编译生成的文件大小巨幅增大,而如下是关闭RTTI的方法:
There are some options which reduce the final executable size somewhat:
{$WEAKLINKRTTI ON} or dcc32 –weaklinkrtti command-line option
But a recompile of choice RTL and VCL units is required to eliminate much actual RTTI data, using this directive:
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
The ‘EXPLICIT’ causes any classes defined after this point in the file to not inherit RTTI settings from the ancestor class, while the method, property and field clauses indicate that no extended RTTI should be produced for any of these elements at any level of visibility.
Having a decent level of RTTI available by default means that third-party libraries can assume its existence. The default level includes RTTI for all fields, which means that object graphs (modulo external resource links) are e.g. serializable at the binary level by default; public methods and properties having RTTI means that e.g. containers using Inversion of Control can apply to objects by default.