• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

Very big Dll - how to make it smaller

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
TomazB
Asked:
TomazB
  • 3
  • 3
  • 3
  • +6
1 Solution
 
nnbbb09Commented:
Try building your dll with runtime packages.

Jo
0
 
intheCommented:
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
 
AvonWyssCommented:
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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
GwenaCommented:
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
 
TomazBAuthor Commented:
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
 
GwenaCommented:
The dll's will decompress automatically... no trouble at all
0
 
nnbbb09Commented:
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
 
nnbbb09Commented:
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
 
shaneholmesCommented:
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
 
shaneholmesCommented:
www.aspack.com

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

Shane Holmes
0
 
shaneholmesCommented:
www.aspack.com

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

Shane Holmes
0
 
DragonSlayerCommented:
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
 
Colin_DawsonCommented:
Compile your dll with the debuging options turned off!
0
 
AumCommented:
"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
 
GwenaCommented:
"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
 
TomazBAuthor Commented:
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
 
TomazBAuthor Commented:
Well, a lot of work was here but a little progress.
Anyway Gwena gave me the most info to work on.
Thanks
0
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.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 3
  • 3
  • +6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now