mozilla/cbindgen
View on GitHub ↗ ★ 2,964 Rust
A project for generating C bindings from Rust code
15 mentions on Hacker News by 15 people: 0 stories, 15 comments · first 2017-09-07 · latest 2025-07-02
20082026
-
…bindings. cbindgen is the recommended crate to generate a C interface for your Rust library: https://github.com/mozilla/cbindgen
comment by thesuperbigfrog · 2025-07-02 · in Ask HN: Exposing C ABI from Rust library? -
…will often autogenerate the header file for the exposed functions using a tool like cbindgen: https://github.com/mozilla/cbindgen We can see that PRQL is using cbindgen here to automatically create a C header:…
comment by coder543 · 2025-02-11 · in How about trailing commas in SQL? -
…which Mozilla seems to use to call Rust from C++ in their web browser, maybe it would “just work”: https://github.com/mozilla/cbindgen?tab=readme-ov-file
comment by jitl · 2024-10-02 · in SlateDB – An embedded database built on object storage -
There's also cbindgen for going the other way around. https://github.com/mozilla/cbindgen
comment by frankjr · 2024-07-15 · in Rust for Filesystems -
You can backport Rust standard library to C using https://github.com/eqrion/cbindgen .
comment by oneshtein · 2023-04-06 · in C Strings and my slow descent to madness -
…C API, compile it into a shared library and use it on the D side as any other library. cbindgen ( https://github.com/eqrion/cbindgen ) can help with generation of header files. Static linking is possible as well. Using D code in Rust…
comment by newpavlov · 2022-11-03 · in Next C compiler is a D compiler: Introducing DMD's ImportC -
Mozilla's uses a combination of https://github.com/eqrion/cbindgen and https://github.com/rust-lang/rust-bindgen depending on the direction of interop. These tools don't provide the safety guarantees of https://github.com/dtolnay/cxx but…
comment by muizelaar · 2020-08-19 · in Rust and C++ Interoperability in Chrome -
…know that it should be a lot easier to create C/C++ compatibility than doing a rewrite or port. [1] https://github.com/eqrion/cbindgen EDIT: Or as the sibling comment points out, there ARE C implementations out there, so you can ignore…
comment by akubera · 2019-07-21 · in Understanding IPFS in Depth(5/6): What Is Libp2p? -
…works very well. So, you may also consider writing your program in rust… If that's possible. [0]: https://github.com/eqrion/cbindgen [1]: https://github.com/rust-lang/rust-bindgen
comment by maowtm · 2019-07-05 · in TLS Performance: Rustls versus OpenSSL -
…It's not exactly what you want, but it's certainly far closer than wasm-bindgen is. [0]: https://github.com/eqrion/cbindgen
comment by Sean1708 · 2018-12-03 · in How I Wrote a Modern C++ Library in Rust -
…and source, outputs Rust code that is semantically equivalent to the C (modulo bugs, etc.) * https://github.com/eqrion/cbindgen/ - Inputs are Rust source, outputs C/C++ headers that can be used to interoperate with the types and functions…
comment by swgillespie · 2018-08-24 · in The Dark Arts of Advanced and Unsafe Rust Programming -
There's a tool called cbindgen ( https://github.com/eqrion/cbindgen ) that generates header files from rust code . It's a bit experimental. The reverse tool, bindgen ( https://github.com/rust-lang-nursery/rust-bindgen/ ) is more mature --…
comment by Manishearth · 2018-03-09 · in Relibc: C Library in Rust for Redox and Linux -
…[1]: https://libpasta.github.io/blog/bindings/ [2]: http://jakegoulding.com/rust-ffi-omnibus/ [3]: https://github.com/eqrion/cbindgen
comment by samjs · 2018-03-09 · in Relibc: C Library in Rust for Redox and Linux -
…edit2: and I should mention the inverse, Rust to C bindings, https://github.com/eqrion/cbindgen https://docs.rs/cbindgen/0.1.23/cbindgen/
comment by bluejekyll · 2017-09-07 · in LLVM 5.0.0 Release