Advertisement

getting a small filesize w/ c++

Started by April 21, 2001 11:34 PM
3 comments, last by thuned 23 years, 9 months ago
i use vc++ 6.0 and when i to a simple "hello world" program using console mode the exe comes out to be 16k. now i know windows fills the exe w/ 0''s for some weird file restrictions so i used upx to get it to like 2.5k. that''s still a bit big, how can i get it smaller w/o using asm? life is unfair, take advantage of it. UNMB2 - if the link doesn''t work, try clicking it
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
Not including the default libraries?

Don''t use UPX, it makes your program use around 10 times as much RAM.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/
Advertisement
well, i used /opt:ref and also multithreaded dll. as for upx, i only noticed like a 10% increase in ram usage (win2k task manager), or is there anything else that''s better?

life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
I don''t personally think 16 KB is all that big of a file (my current project''s executable''s size is around 88 KB, and it is just the core right now). Paint Shop Pro 7''s executable is 8.82 MB . I wouldn''t worry about file size as much as runtime RAM usage.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/
Make sure that you set your build to a Release Build. My Hello World program in C++ on Win98 is only 3.5 KB

And UPX bloats up your memory footprint. Make a bigger app. You'll see a bigger difference.

Personally, I think file sizes aren't as important as the amount of memory the program uses when run.

Oh and use the linker option /OPT:NOWIN98 as well. That shaves about 7 KB of the exe size

Edited by - NuffSaid on April 22, 2001 7:55:22 AM
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.

This topic is closed to new replies.

Advertisement