What makes a small program?
Or, what makes an executable grow bigger? Say that if I want to write a 64K OpenGL demo, what kind of things would I have to keep in mind while programming, not looking at things like textures etc, but really coding techniques?
For example : does a "uses" (a.k.a. include) statement to unused code enlarge my executable, or will the compiler ignore it, as it is not used?
BTW : I''m using Borland Delphi to code my programs, if that makes any difference...
I tellz you what. Depends on the compiler. Delphi is awesome though. I think you''re fine. MSVC++ 6 is also rather decent.
Good compilers don''t include code that is guaranteed not to be used in the EXE. When you use some of the functions from the standard includes, you may unknowingly drag in a whole chain of functions that the function you used depends on.
Example (in C++): including iostream.h makes your file grow by something like 350k. Crazy stuff. (that''s one of the reasons I don''t normally use streams).
I''m not sure what units the size of a delphi app would depend on, but I think delphi apps are quite large in general, since they include a whole visual library. For a simple programme, you''re looking at something like 400 KB at least.
BTW, why would you care about the EXE size anyway?
------------------------
CRAZY_DUSIK* pCrazyDuSiK = new CRAZY_DUSIK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);
Good compilers don''t include code that is guaranteed not to be used in the EXE. When you use some of the functions from the standard includes, you may unknowingly drag in a whole chain of functions that the function you used depends on.
Example (in C++): including iostream.h makes your file grow by something like 350k. Crazy stuff. (that''s one of the reasons I don''t normally use streams).
I''m not sure what units the size of a delphi app would depend on, but I think delphi apps are quite large in general, since they include a whole visual library. For a simple programme, you''re looking at something like 400 KB at least.
BTW, why would you care about the EXE size anyway?
------------------------
CRAZY_DUSIK* pCrazyDuSiK = new CRAZY_DUSIK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);
If you want to do a 64kb program, the best is that you program in win32 asm, using TASM5 or MASM32, and you need to aply techniques of optimization of size, and to use ONLY the part of opengl libraries what you need.
Sorry of my english
Sorry of my english
quote:Original post by dusik
Example (in C++): including iostream.h makes your file grow by something like 350k. Crazy stuff. (that''s one of the reasons I don''t normally use streams).
It is not that much. Try a cout "hello world" vs an printf "hello world" and you''ll see the difference is less than 200k, and that''s in debug mode. With optimisations on it''s likely to be even less.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
i honestly know nothing of delphi, but the most obvious answer to reducing executable size would be to dynamically link to as many things as possible, i.e. leave as much code outside of your executable as possible. more demo oriented sites might have more information about this, maybe cfxweb.net or similar?
ewen
ewen
I dont know why people care so much about the size of the exe its no big deal really. I mean who gives a rats arse...
I''ve been doing contract work in delphi the past few months again so I''ll put in my 2 cents.
Lets say we have a tiny delphi app like this
Tiny huh? Not, it''s 307KB
But if you drop the uses Forms and the other code, its only 17KB, better huh, so you will have to get a window the manual way, that should keep the size down.
Also have a look at these links
http://www.theproduct.de/index.html
http://upx.sourceforge.net/
Lets say we have a tiny delphi app like this
program Project2;uses Forms, Unit1 in ''Unit1.pas'' {Form1};{$R *.RES}begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run;end.
Tiny huh? Not, it''s 307KB
But if you drop the uses Forms and the other code, its only 17KB, better huh, so you will have to get a window the manual way, that should keep the size down.
Also have a look at these links
http://www.theproduct.de/index.html
http://upx.sourceforge.net/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement