4 ms·
I think this Win32 app could be done in C under 20 kB.
by vardump 1y ago
I think this Win32 app could be done in C under 20 kB.
- iforgotpassword 1y agoIirc mingw links its libc statically, that's probably why. Fwiw I still remember that an empty VB6 project with one form compiles to 20kb (16 if you select "optimize for size"). It still needs its VM, which is a dll that was considerably larger. I think about 1mb, but it's been a while.
- sixtram 1y agoWe shipped our VB6 software on a 1.44 MB floppy disk. Actually, we had to add some random stuff to the installer to make our software fit on two floppies instead of one, so that customers would think our application was more complex. Our CEO wanted to make sure that the end user had to eject disk 1 and insert disk 2 during the installation. Sometimes you want to go big. So size matters.
- exe34 1y agoThat's amazing! It reminds me of when a client once asked to make the red more red. I asked him to look at it again the next day and he said it was much better. I didn't have to do anything.
- SoftTalker 1y agoSimilar to programs like TurboTax that add delays and “working” animations to make the user think something really complicated is being achieved.
- chuckadams 1y agoI remember TheGun, a Win32 notepad app in 6K, written in MASM. Anyone know where to find it?
- mananaysiempre 1y agohttps://web.archive.org/web/20051230021217/http://www.movsd.com/thegun.htm https://web.archive.org/web/20051230021217/http://www.movsd....
- DarmokJalad1701 1y agohutch was a legend. RIP. https://forum.exetools.com/showthread.php?p=127834 https://forum.exetools.com/showthread.php?p=127834
- tom_ 1y agoI built it with VC++ and it's 23,552 bytes. Close enough. Command line: cl /Zi /MD /Os /Fetest.exe gui.c main.c todo.c comctl32.lib user32.lib gdi32.lib shell32.lib advapi32.lib /link /opt:ref /opt:icf
- mananaysiempre 1y agoSo, this uses the DLL version of the Microsoft CRT. Don’t know if that counts as cheating :) Why is a CRT needed here anyway, beyond very basic stuff like startup code and memcpy?.. Is MiniCRT[1] an option? [1] http://www.malsmith.net/minicrt/ http://www.malsmith.net/minicrt/
- tom_ 1y agoIt possibly isn't, and you can typically do without by telling VC++ to build without linking to it - though the compiler has a bad habit of generating calls to memcpy, so you may have to provide your own implementation of that (and hope the compiler doesn't spot what you're doing and helpfully replace it with a call to memcpy). But aside from that, it's easy enough. You don't need the CRT startup code; you can use WriteConsole to print to stdout/stderr; you can use LocalAlloc/LocalFree to allocate memory; there's a few string routines in the Win32 DLLs that are a bit like the C equivalents, if nothing in the ordinary Win32 API does what you want. I used to be into this stuff and created a number of useful <10 KB EXEs this way. I'm not sure it's really worth it though! I started out writing code for computers where you'd have like 16 KB free RAM, and this wasn't much, but for most purposes you didn't actually have to sweat every single last byte. So on the same basis, now that even my laptop (which is over 10 years old) has 16 GB RAM, I am not massively inclined to worry about anything less than 1 MB.
- ziml77 1y agoThe downside to me knowing how small programs can be if I don't link the CRT is that I can't help but feel like what I've written is terribly bloated if I don't make an effort to avoid the CRT. I blame people who constantly comment about how bloated software is now for making overly conscious of program size even when its down at a point where it doesn't matter :')