Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Raw bindings to platform APIs for Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

rust-lang/libc

GHA StatusCirrus CI StatusLatest VersionDocumentationLicense

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.

v1.0 Roadmap

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.2branch if needed.

We will stop making new v0.2 releases once v1.0 is released.

See the section inCONTRIBUTING.md for moredetails.

Usage

Add the following to yourCargo.toml:

[dependencies]libc ="0.2"

Features

  • 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: allstructs implemented inlibc areCopy andClone.This feature derivesDebug,Eq,Hash, andPartialEq.

Rust version support

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.

Platform support

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.

License

This project is licensed under either of

at your option.

Contributing

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.


[8]ページ先頭

©2009-2025 Movatter.jp