3 ms·
C doesn't leverage the free run time of the OS, when that OS is Windows. Your hello.exe size has to include the run-time DLL's required for it from the C implem
by kazinator 3y ago
C doesn't leverage the free run time of the OS, when that OS is Windows. Your hello.exe size has to include the run-time DLL's required for it from the C implementation that was used to build it.
Windows has only recently been moving toward providing a public run-time for C; the "Universal C Run-Time" (UCRT) that has been introduced in Windows 10.
- ChrisSD 3y agoThe ucrt is included as far back as Windows 7 (if you install updates).
- kazinator 3y agoThe increment in disk space usage caused by the update has to count toward the effective size of the hello program, experienced by the user of that installation.
- ziml77 3y agoFor some reason, even with the UCRT, binaries seem overly bloated. I've been toying with Zig over the past couple weeks and I really like that it doesn't rely on a C runtime on Windows. Plus it makes it easy to operate entirely with UTF-16 strings, which is a nice to have when I'm writing a utility that is specific to Windows.
- mananaysiempre 3y ago> C doesn't leverage the free run time of the OS, when that OS is Windows. Stdio, no. Printf, no (unless you’re an adherent of LIBCTINY[1] or one of its descendants[2] and need only a minimal set of features). Malloc, yes—MSVC’s malloc() on Win32 has always been a thin wrapper around kernel32!HeapAlloc. Strlen or memcpy or whatnot—also possibly yes, but it’s not like minimal implementations of those are large anyway. [1] http://bytepointer.com/resources/pietrek_libctiny_1996.htm http://bytepointer.com/resources/pietrek_libctiny_1996.htm [2] https://www.benshoof.org/blog/minicrt https://www.benshoof.org/blog/minicrt