- Notifications
You must be signed in to change notification settings - Fork1.1k
Raw bindings to platform APIs for Rust
License
Apache-2.0, MIT licenses found
Licenses found
rust-lang/libc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
libc
provides all of the definitions necessary to easily interoperate with Ccode (or "C-like" code) on each of the platforms that Rust supports. Thisincludes type definitions (e.g.c_int
), constants (e.g.EINVAL
) as well asfunction headers (e.g.malloc
).
This crate exports all underlying platform types, functions, and constants underthe crate root, so all items are accessible aslibc::foo
. The types and valuesof all the exported APIs match the platform that libc is compiled for.
Windows API bindings are not included in this crate. If you are looking forWinAPI bindings, consider using crates likewindows-sys.
More detailed information about the design of this library can be found in itsassociated RFC.
Currently,libc
has two active branches:main
for the upcoming v1.0 release,andlibc-0.2
for the currently published version. By default all pull requestsshould targetmain
; once reviewed, they can be cherry picked to thelibc-0.2
branch if needed.
We will stop making new v0.2 releases once v1.0 is released.
See the section inCONTRIBUTING.md for moredetails.
Add the following to yourCargo.toml
:
[dependencies]libc ="0.2"
std
: by defaultlibc
links to the standard library. Disable this featureto remove this dependency and be able to uselibc
in#![no_std]
crates.extra_traits
: allstruct
s implemented inlibc
areCopy
andClone
.This feature derivesDebug
,Eq
,Hash
, andPartialEq
.
The minimum supported Rust toolchain version is currentlyRust 1.63.
Increases to the MSRV are allowed to change without a major (i.e. semver-breaking) release in order to avoid a ripple effect in the ecosystem. A policyfor when this may change is a work in progress.
libc
may continue to compile with Rust versions older than the current MSRVbut this is not guaranteed.
You can see the platform(target)-specific docs ondocs.rs, select a platformyou want to see.
Seeci/verify-build.sh
forthe platforms on whichlibc
is guaranteed to build for each Rust toolchain.The test-matrix atGitHub Actions andCirrus CI show the platforms in whichlibc
tests are run.
This project is licensed under either of
at your option.
We welcome all people who want to contribute. Please see thecontributing instructions for more information.
Contributions in any form (issues, pull requests, etc.) to this project mustadhere to Rust'sCode of Conduct.
Unless you explicitly state otherwise, any contribution intentionally submittedfor inclusion inlibc
by you, as defined in the Apache-2.0 license, shall bedual licensed as above, without any additional terms or conditions.
About
Raw bindings to platform APIs for Rust
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Security policy
Uh oh!
There was an error while loading.Please reload this page.