Is D6 linker unsmart, or is there another explanation

points to anyone who can a) confirm b) explain c) tell me how I can fix it .. ie make D6 produce exes and dlls the same size as D5

Is the smart linker in D6 broken?

For a do nothing app and dll (source and compiler switches below),
I get the following compiled sizes.
     exe   dll
D5  288kb  59kb
D6  386kb  147kb

This is with D5 Pro and D6 Pro.

can someone who has a comparable version of D6 please confirm.

{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
program Project_Test1;

  Unit1 in 'Unit1.pas' {Form1};

{$R *.RES}

  Application.CreateForm(TForm1, Form1);
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
unit Unit1;

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

  TForm1 = class(TForm)

  Form1: TForm1;


{$R *.DFM}

 object Form1: TForm1
  Left = 330
  Top = 230
  Width = 696
  Height = 480
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
library DLL_test1;

{$R *.RES}


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.

You can do nothing to make them equal.
It only means that the runtime packeges has grown.
Mutley2003Author Commented:
I am not using runtime packages. I am fairly sure that in D7 I can get the D5 sizes. I can get the D5 size in D6 for the DLL by simply commenting out the uses clause. So it looks like a linker issue to me.

In the source above for Unit1, I see you can remove some units - Dialogs, Graphics, Messages.

Once I checked check a DLL size in D3 and D6. Version 6 produced twice bigger executable, no matter what you do. Even if you build with runtime packages, it is again bigger. The reason for this is that Delphi internal units has grown. You can check in $Delphi/Lib folder about the size of SysUtils, Windows units in both Delphi 6 and 5 versions.

Just for comparison with D7:
SysUtils.dcu - 135 KB
Windows.dcu - 605 KB
Classes.dcu - 197 KB
Forms.dcu - 168 KB
Controls.dcu - 202 KB
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Wim ten BrinkSelf-employed developerCommented:
There's a simple reason for the expansion... The Delphi libraries have grown a bit. More logic has been added to the VCL and this comes at a price: Bigger binaries.
Especially the Classes unit has a few more classes that all add to the additional overhead. Problem is, the smart compiler is unsure if it can strip certain classes from the final binary because they are actually used in other locations.

Just for comparison with D5:
SysUtils.dcu - 95 KB
Windows.dcu - 613 KB
Classes.dcu - 158 KB
Forms.dcu - 163 KB
Controls.dcu - 186 KB

If you compare these with Delphi 7 you will notice that the libraries have grown a bit. (Thanks, Ivanov_G) There are some developers who will even continue to use Delphi 2 because this Delphi version still produces the smallest executables. But the newest versions are a lot richer in abilities.

One thing you could try is use the sources of Delphi 5 to rebuild the libraries of Delphi 6 or 7. It would not suprise me if the executable sizes will become smaller again. The drawback however is the reduced functionality and furthermore, there's a risk of the Delphi IDE being too dependant of the version-related library. Thus, recompiling the Delphi 5 libraries with Delphi 7 could crash your IDE.
Mutley2003Author Commented:

Someone with a D7 compiler .. could you please cut and paste the above code and compile.
I am willing to bet (points, that is) that the resultant exes and dlls are SMALLER than the D6 ones.

Even better still, somone with a D6 compiler .. I'd like to confirm that you get the same exe and dll sizes I do. My D6 is upgrade pack 2.

thank you everyone

D7 Pro Exe 368kb
dll 87kb
D7 Pro not upgraded

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
Mutley2003Author Commented:
thanks mokule,

so it looks like the D6 linker is seriously unsmart for the DLL.  But maybe it is because of upgrade packs?

I am still wanting to see if anyone can reproduce my D6 results.

If you really need tiny binaries , you should give a look at kol
This is a good replacement for base units and vcl , of course functionnality is reduced
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

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.