On Friday, August 24, 2018 4:18:31 AM MDT Mike Franklin via Digitalmars-d wrote: > On Friday, 24 August 2018 at 09:46:08 UTC, Jonathan M Davis wrote: > > For any kind of normal operating system, you _have_ to use > > libc. It's part of the OS. Some pieces could be done without > > it, but on the whole, you use libc if you want to talk to the > > OS. That's just life. The only exceptions I'm aware of to that > > are embedded devices, and my understanding is that if anything, > > such devices are more and more likely to run a fullblown OS, > > making it that much less likely that you'd ever do anything > > without libc. > > That is not true. You can write your own system calls. Here's > "hello world" with no libc:
Linux is the only OS I'm aware of that considers the syscall layer to be something that anything outside the OS would normally call. Other OSes consider libc to be part of the OS. In theory, you could call the syscalls directly in the BSDs (and probably on Mac OS), but the expectation is that you're going to use libc. Calling them directly would be way more error-prone, since you'd basically have to reimplement portions of libc and have to deal with any changes they make which normally would be hidden by libc. You're basically trying to bypass the OS' public API if you're trying to bypass libc. And of course, that's definitely not how things are done on Windows. Honestly, I don't see how it's at all reasonable to be trying to access syscalls directly rather than using libc under any kind of normal circumstances - especially if you're not on Linux. - Jonathan M Davis