talira

Raw bindings to platform APIs for Rust

open sourceMIT OR Apache-2.0free

libc is the Rust project's crate of raw FFI bindings to each platform's system libraries: the type definitions (such as c_int), constants (such as EINVAL) and function declarations (such as malloc) needed to call C code on every platform Rust supports, all exported at the crate root and matching the platform it's compiled for. It works without the standard library (no_std) and doesn't cover the Windows API (the windows-sys crate does). Version 0.2 is the published line while 1.0 is in alpha; it's dual-licensed MIT or Apache-2.0.

Problems it solves

  • call a C system function like malloc or ioctl from Rust
  • get the right C types and constants for the platform my Rust code compiles on
  • low-level bindings to the operating system for a Rust crate without the standard library

Features

  • C type definitions, constants and function declarations for each platform
  • covers every platform Rust supports, except the Windows API
  • works in no_std crates
  • MSRV Rust 1.65

Alternatives

The same job

These do what libc does.

  1. windows-rs Microsoft's Rust crates for calling Windows APIs, from COM and WinRT to system services and raw bindings
  2. nix (Rust) Safe Rust bindings to Unix and Linux system APIs

Compare libc with the top 3