top | item 30405397

(no title)

Gaelan | 4 years ago

> I am not claiming that running on an OS is the same as dynamically linking with a library

In pretty much any case, it literally is: you're dynamically linking against the libc. This is a little fuzzier on Linux (because, as you mention, multiple libc implementations exist), but on Windows, macOS, and the BSDs, the only supported way to make syscalls is to make calls into a dynamically linked libc, provided by the operating system.

discuss

order

tsimionescu|4 years ago

Well, theoretically you could make a (pretty useless) Windows program that doesn't do any syscalls itself. It would mostly be limited to heating up the processor, but it would be a valid program. In fact, you could probably actually do some basic syscalls without linking to NTDLL by using very old DOS syscalls for things like printing to the console, perhaps with a compatibility mode.

Also, being pedantic, in Windows libc is a wrapper over Win32, which is partly itself a wrapper over NTDLL. For example, msvc's malloc() simply calls HeapAlloc() or some variant thereof.