2 ms·
But why does it want to not dynamically link against a platform's libc? What is the advantage in that? including that into a binary seems about as senseless to
by Blikkentrekker 6y ago
But why does it want to not dynamically link against a platform's libc?
What is the advantage in that? including that into a binary seems about as senseless to me as including the entire kernel in it.
- zlynx 6y agoFor containers Go static binaries are great. Used to build Docker containers for Kubernetes using a 8 MB Go binary. That was all you needed. No libraries. No "minimum OS' Alpine or Ubuntu image.
- Blikkentrekker 6y agoThat seems to be a sensible use yes, but those aren't really any targeted and supported platform.
- badsectoracula 6y agoNot all platforms have a "libc". Linux is an example: there is no standard c library and while glibc is very common, there are several distributions that use other C libraries like uClibc and musl. For example a gaming handheld i have which is running Linux uses uClibc Another example is Windows, the platform API does not provide a C library (even MSVC has its own). While there is an MSVCRT.DLL it is not recommended to link against it as it is there only because some other software relies on it and its semantics are for around Visual C++ 4 (IIRC).
- pjmlp 6y agoWindows used to be an example like any other non-POSIX OS, however as of Windows 10, the C standard library is part of the OS. https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/ https://devblogs.microsoft.com/cppblog/introducing-the-unive...
- badsectoracula 6y agoAh yes, i've forgotten about it. I wonder how reliable that is as i noticed a bunch of applications i have ship their own copy of ucrtbase.dll.
- Blikkentrekker 6y agoBut Linux is not a platform in general. It is already next to impossible to write software that requires “Linux” and nothing more with all the kernel functionality that can be enabled or disabled. Linux is a component of many different platforms, which indeed do provide different libcs, but also different t.l.s. libraries, different c.p.u. architectures, different Linux configurations and whatever else. As far as I know with respect to Windows, it only provides stable interfaces viā C libraries, and does not have a stable binary interface to the kernel directly.
- badsectoracula 6y agoRight, Windows has a stable C API, but the comment i replied to was about a platform libc.