Crates.io | c-gull |
lib.rs | c-gull |
version | |
source | src |
created_at | 2022-11-08 16:28:05.684922 |
updated_at | 2024-10-20 16:09:05.838117 |
description | A libc implementation in Rust |
homepage | |
repository | https://github.com/sunfishcode/c-ward |
max_upload_size | |
id | 708133 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
c-gull is a libc implementation. It is an implementation of the ABI described by the libc crate.
It is implemented in terms of crates written in Rust, such as c-scape, rustix, origin, libm, realpath-ext, tz-rs, printf-compat, num-complex, and posix-regex.
Currently it only supports *-*-linux-gnu
ABIs, though other ABIs could be
added in the future. And currently this mostly focused on features needed by
Rust programs, so it doesn't have all the C-idiomatic things like qsort
yet,
but they could be added in the future.
The goal is to have very little code in c-gull itself, by factoring out all of the significant functionality into independent crates with more Rust-idiomatic APIs, with c-gull just wrapping those APIs to implement the C ABIs.
This is currently highly experimental, incomplete, and some things aren't optimized. And it depends on Nightly Rust.
c-gull has two main cargo features: "take-charge" and "coexist-with-libc". One of these must be enabled.
In "take-charge" mode, c-gull takes charge of the process, handling program
startup (via Origin) providing malloc
(via c-scape), and other things. This
requires some additional setup; see the c-gull-example example crate for
more details.
In "coexist-with-libc" mode, c-gull can be used as a drop-in (partial) libc replacement. To use it, just change your typical libc dependency in Cargo.toml to this:
libc = { version = "<c-gull version>", package = "c-gull", features = ["coexist-with-libc"] }
and c-gull will replace as many of the system libc implementation with its own
implementations as it can. In particular, it can't replace malloc
or any of
the pthread functions in this configuration, but it can replace many other
things. See the libc-replacement example for more details.