Hacker GitHub

← All repos

rust-lang/rust-bindgen

View on GitHub ↗ ★ 5,314 Rust

Automatically generates Rust FFI bindings to C (and some C++) libraries.

26 mentions on Hacker News by 25 people: 0 stories, 26 comments · first 2017-09-07 · latest 2025-08-04

Mentions per year 26 mentions · busiest year 2018 (4)
20082026
  1. …on a "Handle" type in Rust often is the most idomatic Rust representation of the C interface. [1]: https://github.com/rust-lang/rust-bindgen
  2. …the easiest part of cpp FFI - the hard part is the rest of the ABI. anyone curious can start here https://github.com/rust-lang/rust-bindgen/issues/778
    comment by almostgotcaught · 2025-07-11 · in Jank is C++
  3. …use the crate without unstable features. In the FFI area: Bindgen support for toml configuration ( https://github.com/rust-lang/rust-bindgen/pull/2917 but it could also be response files on the command line), and easier passing of closures…
    comment by bonzini · 2024-12-03 · in Rust in QEMU Roadmap
  4. …other codebases seamlessly, hence the choice of no runtime, no garbage collector etc. Bindgen ( https://github.com/rust-lang/rust-bindgen ) and similar tooling were around essentially since day one to assist in that. It’s the only approach…
  5. …use a tool like bindgen to automatically generate those extern declarations from a C header file: https://github.com/rust-lang/rust-bindgen There's an argument to be made that something like bindgen could be included in Rust, not requiring…
    comment by lambda · 2024-07-15 · in Rust for Filesystems
  6. …consuming C interfaces. Bindgen works quite well for the use case that you are thinking. https://github.com/rust-lang/rust-bindgen
    comment by tupshin · 2024-07-15 · in Rust for Filesystems
  7. …to Safer Rust" (2022) https://scholar.google.com/scholar?q=related:WIDYx_PvgNoJ:sc... rust-bindgen https://github.com/rust-lang/rust-bindgen/ : Automatically generates Rust FFI bindings to C (and some C++) libraries nushell/nushell looks…
    comment by westurner · 2022-09-28 · in Bash 5.2
  8. …just fine. And for what it's worth, I'm pretty sure most of your complaints do apply to that tool. https://github.com/rust-lang/rust-bindgen/
    comment by gpm · 2022-02-02 · in C2rust: Transpile C to Rust
  9. …regions close to the code they are called from in order to get more instruction cache hits. [1] https://github.com/rust-lang/rust-bindgen [2] https://www.techradar.com/news/google-chrome-is-now-dramatic...
  10. …Comments are lower than whitespace as far as the compiler should be sure. As I'm sure you are aware https://github.com/rust-lang/rust-bindgen does basically what you want. I'm actually quite curious where exactly rust-bindgen falls short…
    comment by nixpulvis · 2021-06-20 · in Obvious and possible software innovations
  11. …stuck here[0] with some bindgen issue. If anyone wants to help that would be appreciated heaps. [0] https://github.com/rust-lang/rust-bindgen/issues/2035
  12. …[2]: https://git.proxmox.com/?p=pve-qemu.git;a=blob;f=debian/patc... [3]: https://github.com/rust-lang/rust-bindgen [4]: https://rust-lang.github.io/rust-bindgen/
  13. …can control the C++ end as well to be able to make it compatible with Rust Strings/Vectors/etc. [0] https://github.com/rust-lang/rust-bindgen [1] https://github.com/dtolnay/cxx
  14. 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
  15. Question: is bindgen std quality yet? It seems there are still largely unsolved problems, e.g. https://github.com/rust-lang/rust-bindgen/issues/1549 which is causing hundreds of warnings in a -sys crate of mine and for which I have no…
  16. …It's important because unless rustfmt is available, bindgen would put everything onto one line: https://github.com/rust-lang/rust-bindgen/issues/1600 Rustc would generate (unrelated) warnings for the generated code but before the bugfix…
    comment by est31 · 2019-11-07 · in Rust 1.39
  17. …can't seamlessly call each other unchanged, but bindgen adds FFI glue that makes it much easier. https://github.com/rust-lang/rust-bindgen
    comment by cpeterso · 2019-10-15 · in My Vision of D’s Future
  18. …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
  19. …} . This slight incompatibility forces writing of converters between C enums and Rust enums. See https://github.com/rust-lang/rust-bindgen/issues/667
    comment by v_lisivka · 2019-04-23 · in Rust's 2019 Roadmap
  20. …header files and automatically generating Rust FFI code to match is exactly what rust-bindgen does https://github.com/rust-lang-nursery/rust-bindgen
  21. …are a couple of projects that do this for Rust, depending on what your inputs and outputs are: * https://github.com/rust-lang-nursery/rust-bindgen - Inputs are C/C++ headers, outputs are Rust type definitions and extern functions to…
  22. https://github.com/rust-lang-nursery/rust-bindgen/issues/104... So yeah looks like I'm tethered to the nightly toolchain after all. :/
    comment by inferiorhuman · 2018-06-14 · in Elixir at PagerDuty
  23. …) 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 -- generates rust bindings from header files.
    comment by Manishearth · 2018-03-09 · in Relibc: C Library in Rust for Redox and Linux
  24. That's not really necessary, as rust-bindgen already has some support for C++ bindings: https://github.com/rust-lang-nursery/rust-bindgen/blob/maste... Its support is somewhat limited, but… using a Cfront-like approach wouldn't help the…
  25. …will have to manually call constructors, destructors, overloaded operators, etc yourself. source: https://github.com/rust-lang-nursery/rust-bindgen/blob/maste...
  26. Are you familiar with this? https://github.com/rust-lang-nursery/rust-bindgen It will translate a C header into Rust for all your bindings. Something could probably be built to do this more on the fly. If it doesn't already exist. edit:…
    comment by bluejekyll · 2017-09-07 · in LLVM 5.0.0 Release