rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries. (by rust-lang)

Rust-bindgen Alternatives

Similar projects and alternatives to rust-bindgen

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better rust-bindgen alternative or higher similarity.

Suggest an alternative to rust-bindgen

Reviews and mentions

Posts with mentions or reviews of rust-bindgen. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-11-05.
  • Conditionally run some parts of build.rs
    2 projects | reddit.com/r/rust | 5 Nov 2021
    I'm working on a rather large project that for my own personal convince relies on things like bindgen and the cc crate. Also a couple other things like compiling spirv shaders etc. All of which get's run inside my build.rs file.
  • Hey Rustaceans! Got an easy question? Ask here (43/2021)!
    14 projects | reddit.com/r/rust | 25 Oct 2021
    if you wanna do it the "right" way, I'd say to make a chafa-sys crate using something like bindgen, then create a wrapper over chafa-sys using idiomatic rust. If you just want a quick access to a few methods, then libc + extern blocks aren't too bad.
  • Linux/bindgen - dealing with struct members being moved into unions
    2 projects | reddit.com/r/rust | 23 Jul 2021
    Bindgen issue (mostly for discussion): https://github.com/rust-lang/rust-bindgen/issues/2077.
  • Can you inspect a foreign object's signature from Rust (DLL / SO loaded library inspection)?
    1 project | reddit.com/r/rust | 8 Jul 2021
    I think doing this at runtime is the wrong approach, since the dylib does not contain any signatures, so any solution you come up with will be imperfect. It's much more reliable to use something like the --dynamic-loading option to bindgen to check this when compiling. See https://github.com/rust-lang/rust-bindgen/pull/1846
  • Obvious and possible software innovations nobody does
    8 projects | news.ycombinator.com | 19 Jun 2021
    Did you just imply that we put the comments of C headers into our types?! 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 in the eyes of the author. I'm not as familiar with the other FFI libraries the OP linked.

    8 projects | news.ycombinator.com | 19 Jun 2021
    I really dislike the article, here are some reasons (referencing the numbered arguments in the article).

    1. There are many such parsers. Rusts bindgen [1] is one of them, I have written a proprietary one last year. This is pretty common to do for narrow use cases, there just isn't one for "Convert a C API to Ruby"..

    2. "Most VM designs I’ve seen are basically just student exercises". Seriously? Create a better on and get rich then! I'm pretty sure Google would pay good money for something better than v8.

    3. You can run z/OS on EC2. They do very different things. It's like saying I wish that cars were as simple as a strawberry.

    4. "People used to make GUI frameworks which did more than electron apps, looked better and fit in the tens of kilobytes range." That's correct and that's why lots of apps are based on native UI frameworks. For some use cases, electron seems to hit a sweet spot (mostly not having to write UI for each platform and the web too). If you don't like electron apps, don't use them, most run in the browser too.

    5. "Compilers and interpreters should learn how modern computers work." I don't know where to begin here. Modern compilers optimize for latest hardware all the time, one recent example out of thousand others is this [2] where V8 redundantly inserts short functions into memory 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...

  • Anything resembling libpd (Pure Data) for Rust?
    2 projects | reddit.com/r/rust | 18 Jun 2021
    Yes, here.
  • Baby's first Rust with extra steps (XPC, launchd, and FFI)!
    7 projects | dev.to | 16 Jun 2021
    Our goal is to focus on getting our minimal C example into a Rust project. As a newcomer, rust-analyzer was tremendously helpful for discovering functions and API surface. Get Rust from rustup. Afterwards, make a new directory, cargo init, then set up bindgen. Include the same headers as in the example C program in wrapper.h -- they are in the default search path and require no further setup (find where: xcrun --show-sdk-path).
  • Libfive: Solid modeling (CAD) library/tools with Scheme/Python bindings and GUI
    6 projects | news.ycombinator.com | 24 Apr 2021
    I started working on some Rust bindings for this but I'm currently 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

  • Error when building with FFI
    3 projects | reddit.com/r/rust | 13 Apr 2021
    I'm unfamiliar with FFI, but it sounds like the C variable uses thread-local storage (TLS) while the generated binding is an ordinary static variable. bindgen made a mistake, see this issue.
  • Choosing between Rust and C++ for a new project
    4 projects | reddit.com/r/rust | 1 Apr 2021
    For me, it's no question: for new code, I'd write Rust over C++ any day. The syscalls are all built into the standard library; they're no problem. Even if I had to interact heavily with an existing C/C++ library, bindgen and cxx are fantastic; I'd still write my new code in Rust.
  • Is Julia the right fit for this task?
    1 project | reddit.com/r/Julia | 18 Mar 2021
    I've written dozens of wrapper libraries in Rust (mostly private) and the vast majority of the time it's very easy to do, especially if you use bindgen, cbindgen, cxx, autocxx, etc. As far as Julia interop goes, I already posted a link to a crate providing high-level interop. That's not even necessary if you're calling a C-ABI rust function from Julia.
  • Opinions on Rust for hard-realtime/systems development?
    2 projects | reddit.com/r/rust | 9 Mar 2021
    So... Until at least an year ago? Bindgen and cxx exist already
  • Practicality of embedding a lisp/scheme interpreter that is implemented as C library?
    3 projects | reddit.com/r/rust | 2 Mar 2021
    I’ve wrapped a few C/C++ libs with Rust, and getting the “unsafe” part working, especially with bindgen, is straightforward.
  • Haskell ghost knowledge; difficult to access, not written down
    13 projects | reddit.com/r/haskell | 24 Jan 2021
    Yeah, it is certainly advisable to e.g. avoid setjmp/longjmp as in the Lua example above (this was the main reason for the release of Rust 1.24.1). But even for "Rust-aware" C, one has to write a lot of boilerplate. For example, with bindgen, the go-to tool to create bindings to C headers, one has to write (unsafe) wrapper functions which

Stats

Basic rust-bindgen repo stats
16
2,411
8.1
2 days ago

rust-lang/rust-bindgen is an open source project licensed under BSD 3-clause "New" or "Revised" License which is an OSI approved license.

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
Find remote C++ jobs at our new job board 99remotejobs.com. There is 1 new remote job listed recently.
Are you hiring? Post a new remote job listing for free.