News for hackers. Stuff that matters.
Re:How small is the smallest .NET Hello World binary? by whartung on Sunday July 09, 2023 @09:25AM (#36654275)
It’s funny because back in the day these were these kind of discussion points thrown around in the Lisp forums when folks would balk at “executable sizes”.

Specifically about how C leverages the “free” runtime of the OS while Lisp has to bundle is own.

This idea of container runtime sizes would be an amusing thread. A good test of something like Nix or Guix to a very fine grain. “We don’t need bash or ls so we removed it. “ “The VM only simulate a single network card, so we’ll scrap all the other driver. “

Re:How small is the smallest .NET Hello World binary? by kazinator on Sunday July 09, 2023 @11:19AM (#36655178)
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.

Re:How small is the smallest .NET Hello World binary? by ChrisSD on Sunday July 09, 2023 @11:52AM (#36655527)
The ucrt is included as far back as Windows 7 (if you install updates).
Re:How small is the smallest .NET Hello World binary? by kazinator on Sunday July 09, 2023 @12:17PM (#36655773)
The 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.
Re:How small is the smallest .NET Hello World binary? by ziml77 on Sunday July 09, 2023 @02:18PM (#36657264)
For 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.
Re:How small is the smallest .NET Hello World binary? by mananaysiempre on Sunday July 09, 2023 @03:09PM (#36657817)
> 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

[2] https://www.benshoof.org/blog/minicrt