Delphi XE8 程序瘦身.编译后EXE最低90KB
目前網(wǎng)絡(luò)上?XE8程序瘦身基本為XE5以前的方法,雖然該方法也必須援用之前方法.但需要說明一下,現(xiàn)在release比debug瘦身效果相差無幾.我的XE8單獨窗體EXE文件為11056KB.瘦身后exe文件最低可以達到 90KB.
下面是方法介紹.
第一步:關(guān)閉debug infomation.
打開工程后,依次點擊project--option--delphi compiler--linking 將右邊Debug information改為False.
編譯后Debug和Release版都為2142KB.
此處參考http://www.delphifans.com/InfoView/Article_6493.html
第二步: 關(guān)閉RTTi.
點擊Project--view source.在第二行添加編譯開關(guān)代碼
{ 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.
第三步:設(shè)置運行時包.
打開工程后,依次點擊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文件一起放在應(yīng)用程序目錄或系統(tǒng)目錄.我一個單按鈕窗體程序必須拷貝2個bpl文件.
正確的bpl在\Embarcadero\Studio\16.0對應(yīng)的文件夾里面找,比如我的虛擬xp,則為\Embarcadero\Studio\16.0\Bin目錄
而且如果修改了某個控件源碼,意味這必須重編譯該控件.?
總結(jié)
以上是生活随笔為你收集整理的Delphi XE8 程序瘦身.编译后EXE最低90KB的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用FastDFS实现图片服务器的功能【
- 下一篇: 暗域八翼邪龙