delphi xe disable RTTI

前端 未结 5 1334
自闭症患者
自闭症患者 2020-12-03 15:10

i have use delphi xe recently but exe size is very big because of rtti(i think)

howto remove rtti , and can i make my application size as small as delphi 2009 app

5条回答
  •  北海茫月
    2020-12-03 16:01

    It's because some generics functionality has been added to sys units. Generics were added in 2009 but in systems units some classes were rewritten with generics in xe and xe2. imho

    Add this flags to reduce the size in dpr file (Project > view source) to each individual unit (as of XE5)*.

    {$SETPEFlAGS IMAGE_FILE_DEBUG_STRIPPED or IMAGE_FILE_LINE_NUMS_STRIPPED or
     IMAGE_FILE_LOCAL_SYMS_STRIPPED OR IMAGE_FILE_RELOCS_STRIPPED}
    
    {$WEAKLINKRTTI ON}
    {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
    

    (*) Note that as of XE5 and newer, this needs to be in each individual unit for which you want to disable RTTI. Before that (XE4 and below) it could be in the DPR file and would apply to all units in the project.

提交回复
热议问题