www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - dmc executables larger?

reply "Kalon Mills" <cwbugsREMOVECAPS byu.net> writes:
Hello,

I've looking into DMC and getting a feel for it as well as the
free Visual C++ compiler.  I haven't tested anything big yet,
but it seems for small programs the exe file sizes produced by
DMC are larger then the ones produced by the visual c++ compiler.
Can anyone explain this?  I have also noticed that the obj files
are oppisite in relation.  DMC produces smaller OBJ files.  Does
this have something to do with the way that I am linking?


Here are a few examples.

---hello.cpp---
#include <windows.h>

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int   nCmdShow)
{
  MessageBox(NULL, "Hello World!", "Hello", MB_OK);
  return 0;
}
---end hello.cpp---

cl hello.cpp user32.lib    produces exe filesize = 22,528 B
dmc hello.cpp user32.lib   produces exe filesize = 30,236 B


That seems like quite a difference for such a small program.
I've also been going through the opengl tutorials at
nehe.gamedev.net and the same results apply.

For example lesson2:
cl lesson2.cpp opengl32.lib glu32.lib user32.lib gdi32.lib    exe filesize =
40,960
dmc lesson2.cpp opengl32.lib glu32.lib user32.lib gdi32.lib   exe filesize =
46,620


Just trying to figure out what is going on.  Thanks

Kalon
May 26 2004
parent reply Heinz Saathoff <hsaat despammed.com> writes:
Kalon Mills schrieb...
 I've looking into DMC and getting a feel for it as well as the
 free Visual C++ compiler.  I haven't tested anything big yet,
 but it seems for small programs the exe file sizes produced by
 DMC are larger then the ones produced by the visual c++ compiler.
 Can anyone explain this?  I have also noticed that the obj files
 are oppisite in relation.  DMC produces smaller OBJ files.  Does
 this have something to do with the way that I am linking?
I assume the difference in the runtime library (RTL). It seems that the RTL for DMC is bigger than the RTL of VC++. There is nothing you can do about this and in principle this has nothing to do with quality of the compiler. - Heinz
Jun 04 2004
parent "Walter" <newshound digitalmars.com> writes:
"Heinz Saathoff" <hsaat despammed.com> wrote in message
news:MPG.1b2a4239e3494c729896df news.digitalmars.com...
 Kalon Mills schrieb...
 I've looking into DMC and getting a feel for it as well as the
 free Visual C++ compiler.  I haven't tested anything big yet,
 but it seems for small programs the exe file sizes produced by
 DMC are larger then the ones produced by the visual c++ compiler.
 Can anyone explain this?  I have also noticed that the obj files
 are oppisite in relation.  DMC produces smaller OBJ files.  Does
 this have something to do with the way that I am linking?
I assume the difference in the runtime library (RTL). It seems that the RTL for DMC is bigger than the RTL of VC++. There is nothing you can do about this and in principle this has nothing to do with quality of the compiler.
The DMC runtime is a little larger because it contains a bunch of code to interpret exceptions generated by VC++ DLLs.
Jun 04 2004