NO

Author Topic: EXE size ?  (Read 3273 times)

ly47

  • Guest
EXE size ?
« on: June 20, 2014, 06:13:39 PM »
Hi
I have compiled several progs with:
Pellesc and tcc to see exe size results.
(console simple "hello" prog and for win32 a chapter 7 (Checker1) from Petzold book)
So far:
tcc produce      1.50 kb (console) and 4.00 kb (win)
pelles pruduce  29.0 kb (console) and 10.5 kb (win).

I have tried same console  progs to run with assembly:
masm32 and rosasm produce 2.50 kb.

Conclusion: tcc produce the smallest exe.

Can somebody explain the diff. ?

Thanks
ly

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: EXE size ?
« Reply #1 on: June 20, 2014, 08:50:08 PM »
The user code in an exe file, for very simple programs, is few hundreds of bytes, the remaining is taken by startup code, the crt code, and PE-COFF file structure (a couple of hundred of bytes for headers, 8-16 bytes per each relocation in DLL's).
You can reduce the exe in two principal ways: linking with the DLL runtime, or use a simplified (and smaller) c runtime.
Read here for an example of reduced runtime for PellesC, or here for an article on the subject from catch22.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

ly47

  • Guest
Re: EXE size ?
« Reply #2 on: June 20, 2014, 10:18:44 PM »
Hi frankie
Thanks.
Very interesting info.
ly