Skip to content

Why is libc used? #5507

Answered by tertsdiepraam
michaelCTS asked this question in Q&A
Nov 7, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Oh good question! You're gonna get a long answer 😄

We have to do syscalls somewhere, which means that somewhere in our dependency tree, there's unsafe. Either we use unsafe ourselves or we let some library do it for us. libc is used throughout the Rust ecosystem, even in the standard library. This also means that we are always using libc indirectly through std already. It is usually the recommended way to deal with low-level stuff, because libc standardizes behaviour across many platforms. However, that doesn't mean that we're stuck with libc! We want to use as many safe abstractions over libc as possible. The nix crate, for example, provides safe APIs over libc. We also (indirectly) use r…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@michaelCTS
Comment options

Answer selected by michaelCTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants