guys I want to start programing with C++. I have written some programs in vb6, vb.net and now I want to gain knowledge in C++, what I want is a compiler that can compile my code to the smallest windows application. For example there is a Basic language compiler called PureBasic that can make Hello world standalone app's size 5 kb, and simple socket program which i compiled was only 12kb (without any DLL-s and Runtime files). I know it is amazing, so I want something like this for C++.
If I am wrong and there is not such kind of windows compiler can someone give me a website or book that can teach me how to reduce C++ executable size, or how to use Windows API calls?
I had to do this many years ago with VC6. It was necessary because the executable was going to be transmitted over the wire to a target computer, where it would run. Since it was likely to be sent over a modem connection, it needed to be as small as possible. To shrink the executable, I relied on two techniques:
The final executable size: ~2K
Microsoft Visual C++ compiler for example... You just have to turn off linking to the C runtime (/NODEFAULTLIB
) and your executable will be as small as 5KB. There's just one problem: you won't be able to use almost anything from the standard C and C++ library, nor standard features of C++ like exception handling, new
and delete
operators, floating point arithmetics, and more. You'll need to use only the pure OS features (e.g. create files with CreateFile
, allocate memory with HeapAlloc
, etc...).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With