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
20082026
-
…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
comment by GrantMoyer · 2025-08-04 · in A deep dive into Rust and C memory interoperability -
…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++ -
…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 -
…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…
comment by Xylakant · 2024-09-26 · in Eliminating Memory Safety Vulnerabilities at the Source -
…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 -
…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 -
…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 -
…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...
comment by jupp0r · 2021-06-20 · in Obvious and possible software innovations -
…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 -
…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
comment by virtualritz · 2021-04-26 · in Libfive: Solid modeling (CAD) library/tools with Scheme/Python bindings and GUI -
…[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/
comment by tlamponi · 2021-02-15 · in LiteSpeed QUIC (LSQUIC) is an open-source implementation of QUIC and HTTP/3 -
…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
comment by CDSlice · 2020-10-28 · in Ask HN: Should I learn C/C++ or Rust as my first systems programming language? -
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 -
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…
comment by oefrha · 2020-06-14 · in Microsoft: Rust Is the Industry’s ‘Best Chance’ at Safe Systems Programming -
…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 -
…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 -
…} . 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 -
…header files and automatically generating Rust FFI code to match is exactly what rust-bindgen does https://github.com/rust-lang-nursery/rust-bindgen
comment by towerbabbel · 2018-08-24 · in The Dark Arts of Advanced and Unsafe Rust Programming -
…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…
comment by swgillespie · 2018-08-24 · in The Dark Arts of Advanced and Unsafe Rust Programming -
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 -
…) 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 -
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…
comment by comex · 2017-11-17 · in Puffs: Parsing Untrusted File Formats Safely -
…will have to manually call constructors, destructors, overloaded operators, etc yourself. source: https://github.com/rust-lang-nursery/rust-bindgen/blob/maste...
comment by comex · 2017-09-30 · in Cloudflare Workers: Run JavaScript Service Workers at the Edge -
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