Question

I recently moved from Delphi 7 to Delphi XE3.

A dll file that was 107kb in Delphi 7 is now compiling to 2.7 MB. Another that was 114kb is now 4.7 MB!

Is this normal? What might I do to reduce the file sizes? If you need more info please ask.

UPDATE:

Both dll files were already being compiled in release mode.

After following Mason's advice:

The 4.7MB file was reduced to 834kb and the 2.7MB file was reduced to 2.1MB. The 2.1MB file makes use of Generics and an external library called nExcel used for generating Excel files. Whilst nExcel was also used when the file size was smaller the use of Generics is a new addition to the code and I guess may be the reason for the file size remaining fairly large.

Was it helpful?

Solution

Some of it is unavoidable; the RTL has gotten bigger as more functionality was added. However, a lot of that size increase is going to be due to the addition of extended RTTI in Delphi 2010.

You can fix this by putting the following two lines in the main project file, before any uses clause:

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

These will cause the compiler to minimize extended RTTI throughout the project. (Be aware that this means that you won't have the RTTI functionality available. But since this is a Delphi 7 project, you probably aren't using it yet anyway. You'll want to read up on extended RTTI and see if you can find useful things to do with it.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top