Anyone working on a implementation of libr?


#1

Hi everyone.

I’ve been hacking with Rust for a bit now (still very green) and I’m finding that over and over I end up violating safety because I’m always interacting with some C library or libc. I understand there are crates which attempt to safely wrap these libraries, but you’ll never beat Rust on safety. Has anyone started a ‘libr’ to replace libc?


#2

You might be interested in http://blog.adamperry.me/rust/2016/06/11/baby-steps-porting-musl-to-rust/


#3

Ah cool. I’ll follow the progress on his library. That said it would be nice if someone would try this endeavour without copying libc or musl directly. It would be nice to see a library built and designed around the semantics of Rust and Rust’s built in types.


#4

Hm, I think std fits the bill perfectly :slight_smile:


#5

It’s not so great if you are trying to write an OS or embedded software. Doesn’t Rust std depend on libc?


#6

If you are developing OS then you likely don’t want to use libc (or it’s analogue), because it includes a ton of stuff which isn’t applicable in the kernel context. However, there is core library for such cases, which is lower level then libc.

Doesn’t Rust std depend on libc?

Yep, it depends on libc (and for some systems this is inevitable because the libc is the only interface to the OS), but it’s possible to statically link everything.