delphi xe禁用RTTI

发布于 2024-09-28 05:35:49 字数 117 浏览 1 评论 0原文

我最近使用过delphi xe,但exe大小非常大,因为rtti(我认为)

如何删除rtti,我可以使我的应用程序大小与delphi 2009应用程序(490 kb)一样小而不压缩吗? rtti 有什么用

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 application(490 kb) without comprssion; and what is the use of rtti

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

故事还在继续 2024-10-05 05:35:49

简而言之(由飞溅答案中的链接提供的完整故事):

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

请注意 从 XE6 及更高版本开始,这需要位于您要禁用 RTTI 的每个单独单元中。 在此之前(XE5 及更低版本) )它可以位于 DPR 文件中并且适用于项目中的所有单元。

In short (full story provided by links in the splash's answer):

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

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

゛清羽墨安 2024-10-05 05:35:49

你的问题与RTTI无关。如果您谈论的是相对较小的增长(100-200K),这是由于 RTL 中的额外功能(为 Unicode 支持等添加的)。如果增加了 500-700K 左右,请检查是否链接了 VCL UI 单元(表单、控件等)。如果增加了 3Mb,那么您就打开了额外的调试符号。

Your problem is not related to RTTI. If you are talking about relatively small increase (100-200K), this is due to extra functions in RTL (added for Unicode support etc). If you get 500-700K increase or so, then check whether you link VCL UI units (Forms, Controls etc). If you get 3Mb increase, then you've turned on extra debug symbols.

花辞树 2024-10-05 05:35:49

这是因为 sys 单元中添加了一些泛型功能。
泛型是在 2009 年添加的,但在系统单元中,一些类是用 xe 和 xe2 中的泛型重写的。恕我直言,

添加此标志可以减少每个单独单元的dpr 文件(项目 > 查看源代码)的大小(从 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([])}

(*) 请注意,从 XE5 及更高版本开始,这需要位于每个单独的单元中您想要禁用 RTTI。 在此之前(XE4 及更低版本)它可能位于 DPR 文件中,并将应用于项目中的所有单元。

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.

澉约 2024-10-05 05:35:49

我不认为 RTTI 会给您的应用程序增加如此多的大小开销。你怎么知道是这样?

I do not think it is RTTI what adds so much size overhead to your application. How do you know it is?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文