how do i reduce the delphi exe file size

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 ,
samuel_chinnu123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Slick812Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ImbeginnerCommented:
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

GwenaCommented:
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
GwenaCommented:
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
HillGrooverCommented:
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
CleanupPingCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.