Solved

Very big Dll - how to make it smaller

Posted on 2001-06-17
17
322 Views
Last Modified: 2010-04-06
Is there a way to make my Dll smaller? I use a lot of units in my dll:

  ShareMem,
  SysUtils,
  Classes,
  Windows,
  Forms,
  Dialogs,
  DB,
  ExtCtrls

and I know that program needs them. But I don't know how Delphi copiles that units. My dll reached size of 570k.
Does Delphi puts in compiled dll just the necessary kode from units or whole units? If last, is there a way to minimize size of compiled file? (mybe some switches or so) I think that a little form which I need in dll shouldn't make so big file or ......
0
Comment
Question by:TomazB
  • 3
  • 3
  • 3
  • +6
17 Comments
 
LVL 3

Expert Comment

by:nnbbb09
ID: 6199806
Try building your dll with runtime packages.

Jo
0
 
LVL 17

Expert Comment

by:inthe
ID: 6199940
also look at what functions your actually using from the units in the dll and if your only using one or two functions form a particular unit you may be able to just declare it in your dll instead.
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6200174
As soon as the VCL Forms unit is included, applications and DLLs get bloated up very much. That's just the way it is; using packages will make smaller DLL's but require to distribute additional files which will make a total size even larger than the original (non-package) DLL was.
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 5

Expert Comment

by:Gwena
ID: 6200209
You can compress some dll's with the free UPX compressor
I compressed the xaudio.dll from 254976 down to  113152
using UPX --best xaudio.dll

http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
0
 

Author Comment

by:TomazB
ID: 6200265
That compile with runtime packages - how to do that?
Is there any other way to make form (with some controls) than using VCL Foms?
This compress.....I assume that dlls must be decompressed before use in the program. Is this somehow automatic or must I do that within my program and then use dll of normal size from the disc?
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6200273
The dll's will decompress automatically... no trouble at all
0
 
LVL 3

Expert Comment

by:nnbbb09
ID: 6200351
To use runtime package go to Project | Options and select the Packages tab and then check the Build With Runtime Packages checkbox. Then rebuild your dll.
When distributing your dll to other machines you will also need to distribute any VCL packages that it has used. To get this list of packages go to Project | Project Information and it should give you a complete list (you may need to recompile first).

Jo
0
 
LVL 3

Expert Comment

by:nnbbb09
ID: 6200397
To use runtime package go to Project | Options and select the Packages tab and then check the Build With Runtime Packages checkbox. Then rebuild your dll.
When distributing your dll to other machines you will also need to distribute any VCL packages that it has used. To get this list of packages go to Project | Project Information and it should give you a complete list (you may need to recompile first).

Jo
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 6200536
The best tool I have encountered on the market is ASPack.

http://www.aspack.com/

Try it, you will be pleased. This will cut your size from 6ooK to about 300K or less, depeding on the types of resources added to the DLL

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 6200582
www.aspack.com

This will compress it to half the size, with no loss of functionality.

Shane Holmes
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 6200584
www.aspack.com

This will compress it to half the size, with no loss of functionality.

Shane Holmes
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6201001
Anyway, if your DLL will be loaded by multiple applications, packing the DLL might not seem to be wise:

http://www.jrsoftware.org/striprlc.htm
0
 
LVL 4

Expert Comment

by:Colin_Dawson
ID: 6201710
Compile your dll with the debuging options turned off!
0
 

Expert Comment

by:Aum
ID: 6201799
"Is there any other way to make form (with some controls) than using VCL Foms?"

You can use the Windows APIs (CreateWindow, etc.). You can still desing your forms in Delphi's IDE, and then read the .dfm file to get the required properties, like Top, Left, etc. Not a minor task, inded.

Or you can try using XCL, which wraps this for you:

http://members.nbci.com/_XOOM/mr_bonanzas/xcl/index.htm
0
 
LVL 5

Accepted Solution

by:
Gwena earned 50 total points
ID: 6203994
"Is there any other way to make form (with some controls) than using VCL Foms?"

Try looking here   http://mercury.spaceports.com/~bonanzas/kol/

If you use the stuff here instead of delphi's vcl code you can get exe's
as small as 14kb with forms ... and that's with D4 or D5 :-)
0
 

Author Comment

by:TomazB
ID: 6204128
Well since my app uses instances of objects in a few dlls this problem with relocating realy exists. Also a lot of memory is used since three apps uses them. Sims that Dragon is right about dangers with compresss.
This stuff with runtime packages is also tricky. Avon is right. All together is even larger than dll allone. Isn't there a way to tell Delphi to just compile what is needed?
0
 

Author Comment

by:TomazB
ID: 6291061
Well, a lot of work was here but a little progress.
Anyway Gwena gave me the most info to work on.
Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

821 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