How to reduce the volume of EXE files generated by Delphi

Source: Internet
Author: User

I. IDE control

1. Disable the rtti reflection mechanism

Since delphi2010 introduced a new rtti reflection mechanismProgramThis is because delphi2010 adds a reflection mechanism to all classes by default. This function is not used in every project, so we can simply disable rtti reflection in the following ways to greatly reduce the file size.

The method for disabling is very simple, that is, to be in the project (DPR file. The project file in delphi2010 is a dproj file, but the DPR file is still written by default.CodeYou can add the following definitions before the uses statement:

{Disable the rtti reflection mechanism to reduce the size of the EXE file}
{$ If compilerversion >=21.0}
{$ Weaklinkrtti on}
{$ Rtti explicit methods ([]) properties ([]) fields ([])}
{$ Ifend}

2. Disable debug information (disabled by default)

Project-> options-> linking-> debug information-> disabled

Ii. Other Methods

1. reduce the size of the Delphi application

01) Use shelling tools (such as UPX and ASPack)
02) Use Kol
03) do not use VCL to write programs
04) Use ACL (API control library)
05) Use stripreloc
06) Remove the route debugging information and td32
07) Write allowed code to DLL
08) do not place images on the form during design, but load images at runtime.
09) use compressed images (JPG instead of BMP)
10) Reduce attributes in the DFM File

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.