Delphi XE8 程序瘦身.编译后EXE最低90KB.
2016-01-21 10:03
597 查看
目前网络上 XE8程序瘦身基本为XE5以前的方法,虽然该方法也必须援用之前方法.但需要说明一下,现在release比debug瘦身效果相差无几.我的XE8单独窗体EXE文件为11056KB.瘦身后exe文件最低可以达到 90KB.
下面是方法介绍.
第一步:关闭debug infomation.
打开工程后,依次点击project--option--delphi compiler--linking 将右边Debug information改为False.
编译后Debug和Release版都为2142KB.
此处参考http://www.delphifans.com/InfoView/Article_6493.html
第二步: 关闭RTTi.
点击Project--view source.在第二行添加编译开关代码
{ Reduce EXE size by disabling as much of RTTI as possible (delphi 2009/2010) }
{$IF CompilerVersion >= 21.0}
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
{$IFEND}
编译后Debug和Release版都为1728KB.
第三步:设置运行时包.
打开工程后,依次点击project--option--Packages--Runtime Packages 勾选Link with runtime package.
编译后Debug的exe文件为90Kb,Release为1728KB
对于第三步,如不是太计较exe大小,则不是太建议.请看帮助资料.
Runtime packages are deployed with your applications. They provide functionality when a user runs the application.
To run an application that uses packages, a computer must have both the application's executable file and all the packages (.bpl files) that the application uses. The .bpl files must be on the system path for an application to use them. When you deploy an
application, you must make sure that users have correct versions of any required .bpls.
这意味着当选择使用该选项的debug版时,你必须把正确的bpl文件一起放在应用程序目录或系统目录.我一个单按钮窗体程序必须拷贝2个bpl文件.
正确的bpl在\Embarcadero\Studio\16.0对应的文件夹里面找,比如我的虚拟xp,则为\Embarcadero\Studio\16.0\Bin目录
而且如果修改了某个控件源码,意味这必须重编译该控件.
下面是方法介绍.
第一步:关闭debug infomation.
打开工程后,依次点击project--option--delphi compiler--linking 将右边Debug information改为False.
编译后Debug和Release版都为2142KB.
此处参考http://www.delphifans.com/InfoView/Article_6493.html
第二步: 关闭RTTi.
点击Project--view source.在第二行添加编译开关代码
{ Reduce EXE size by disabling as much of RTTI as possible (delphi 2009/2010) }
{$IF CompilerVersion >= 21.0}
{$WEAKLINKRTTI ON}
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
{$IFEND}
编译后Debug和Release版都为1728KB.
第三步:设置运行时包.
打开工程后,依次点击project--option--Packages--Runtime Packages 勾选Link with runtime package.
编译后Debug的exe文件为90Kb,Release为1728KB
对于第三步,如不是太计较exe大小,则不是太建议.请看帮助资料.
Runtime packages are deployed with your applications. They provide functionality when a user runs the application.
To run an application that uses packages, a computer must have both the application's executable file and all the packages (.bpl files) that the application uses. The .bpl files must be on the system path for an application to use them. When you deploy an
application, you must make sure that users have correct versions of any required .bpls.
这意味着当选择使用该选项的debug版时,你必须把正确的bpl文件一起放在应用程序目录或系统目录.我一个单按钮窗体程序必须拷贝2个bpl文件.
正确的bpl在\Embarcadero\Studio\16.0对应的文件夹里面找,比如我的虚拟xp,则为\Embarcadero\Studio\16.0\Bin目录
而且如果修改了某个控件源码,意味这必须重编译该控件.
相关文章推荐
- 【Delphi】GIF 动画建立
- FireDAC简易教程
- Delphi XE7的安卓程序如何调用JAVA的JAR,使用JAVA的类?
- delphi7 编译程序时报win32.indcu.a病毒的解决方法
- Delphi PChar与String互转
- Delphi+MySQL:TADOQuery使用插入中文乱码解决方法
- Delphi中的操作二进制文件的两个重要函数
- Delphi出现“borland license information was found,but it is not valid for delphi”的错误,无法运行的解决方法
- FastReport 动态加载图片
- delphi:斑马打印机ZPL指令打印中文及二维码
- Delphi下使用Sato打印机
- Delphi ListView基本用法大全
- Delphi禁止重复运行同一程序的方法
- 多级接口实现方法
- Panel移动
- Delphi获取句柄并发送消息
- delphi 获取文件所在路径
- 使用delphi+intraweb进行微信开发1--微信平台接入
- 使用delphi+intraweb进行微信开发1--微信平台接入
- Delphi 类方法的搞笑答案