?
Solved

how do i reduce the delphi exe file size

Posted on 2003-03-20
9
Medium Priority
?
655 Views
Last Modified: 2010-04-04
Hi everyone
              how do i reduce the delphi exe file size, if i create a application in delphi the minimum size is 360 kb , but in other languages i can create it in two digit kbs , so how do i over come this , and what increases the file size of a delphi application ,
0
Comment
Question by:samuel_chinnu123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 34

Accepted Solution

by:
Slick812 earned 120 total points
ID: 8178881
hello samuel_chinnu123, the file size of a new delphi app is mostly fron the Forms unit, there is alot of code there for the many things needed to have the  many runtime options for component creation and thing for safety, and to make a delphi app robust (exception handling). . . but alot of of that code is not needed in most programs. To reduce the size of your programs, You can get a Program compressor, I sometimes use  UPX  which is avaiable at

http://upx.sourceforge.net

Or you can maybe try the Key Objects Library, an alternative to the VCL, which gives smaller file sizes, you can see this at

http://bonanzas0.tripod.com/

Or you can NOT use the Forms unit, and just do API programming, but this take some time and effort to learn, you can get info about this at -


http://www.angelfire.com/hi5/delphizeus/index.html
0
 

Expert Comment

by:Imbeginner
ID: 8179186
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Gwena
ID: 8183139
the easy way...
-Use delphi 2
-Use ResHacker to pull out all unneeded resources from exe
-Pack with UPX using this command line
UPX --best MyApp.exe

the hard way...
Use KOl library or use API

The really hard way..
Give up on delphi and use something like the free LCCWin32 C compiler... you will be rewarded with extremely small size exes... some of mine are 5kb in size.

You might also use the free BCX basic to C translator... it turns basic source into C source that LCCWin32 can compile... BCX is nearly as easy to use as Delphi.. it is free and has a nice rad environment called ezide.
There is also a user group for BCX full of friendly guys that will help you along.

:-)
0
 
LVL 5

Expert Comment

by:Gwena
ID: 8183195
As to what increases the size of a delphi exe

Borland decided that being able to quickly develop programs was more important than making them really small... and they are right!

But if you compare Delphi apps to VB apps you will see that it is VB that is bloated. The runtime file for VB is just HUGE... compared to that delphi makes small exe's.

With 512mb memory chips at 49.00 and 120gb HDs at 120.00 exe size is NOT important unless you get beyond 1mb. Anything less than 1mb can be downloaded quickly even on a 28.800 dial-up :-)
0
 
LVL 4

Expert Comment

by:HillGroover
ID: 8364588
In delphi select Project|Options and select the Linker tab, set Map File to Off, set Linker Output to Generate DCUs and untick all the EXE and DLL options.

All EXEs created in delphi have a .reloc section which for EXEs is never needed as they never get relocated in memory like dlls do. so to get rid of that you can use StripReloc from

http://www.jrsoftware.org/files/striprlc.zip

the source code is included with this too :)

once you strip the .reloc section from your EXE you could then use UPX as mentioned above to further reduce the size

The only other thing i can think of would be to copy the forms unit (rename it to MyForms) and take out all the code you can that still allows your code to compile then in the uses section, replace Forms with MyForms(i had done this before and it worked wonders for me, but i have gone through a few Hard Drive formats since then forgetting to back it up and i can't be bothered to go back through it again)

Hope something is useful to you

Hill Groover
0
 

Expert Comment

by:CleanupPing
ID: 9316645
samuel_chinnu123:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question