News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

EXE size ?

Started by ly47, June 20, 2014, 06:13:39 PM

Previous topic - Next topic

ly47

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

frankie

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

Hi frankie
Thanks.
Very interesting info.
ly