Hacker GitHub

← All repos

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

Mentions per year 15 mentions · busiest year 2018 (4)
20082026
  1. …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?
  2. …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?
  3. …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
  4. 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
  5. As a 2-step approach, you could also probably use https://github.com/mozilla/cbindgen and then Nim's native C FFI.
    comment by cb321 · 2023-08-01 · in Nim 2.0
  6. 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
  7. …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…
  8. 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
  9. …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…
  10. …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
  11. …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
  12. …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…
  13. 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
  14. …[1]: https://libpasta.github.io/blog/bindings/ [2]: http://jakegoulding.com/rust-ffi-omnibus/ [3]: https://github.com/eqrion/cbindgen
  15. …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