Expand description

c-scape

A libc implementation in Rust

Github Actions CI Status zulip chat crates.io page docs.rs docs

C-ABI-compatible libc, libm, libpthread, and libunwind interfaces, implemented in terms of crates written in Rust, such as rustix, origin, sync-resolve, libm, realpath-ext, and memchr. Currently this only supports *-*-linux-gnu ABIs, though other ABIs could be added in the future. And currently this only supports features needed by Rust programs, though more support for C programs (eg. printf) could also be added in the future.

The goal is to have very little code in c-scape itself, by factoring out all of the significant functionality into independent crates with more Rust-idiomatic APIs, with c-scape just wrapping those APIs to implement the C ABIs.

This is currently experimental, incomplete, and some things aren’t optimized.

c-scape implements malloc using the Rust global allocator, and the default Rust global allocator is implemented using malloc, so it’s necessary to enable a different global allocator. The mustang crate handles this automatically.

This is part of the Mustang project, building Rust programs written entirely in Rust.

Functions