-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are there still bindings somewhere to the IR construction #65
Comments
I am interested in this as well. I am currently building a small language that compiles directly to webassembly. At the moment I am just generating WAT code and using wasmtime to compile into wasm and run. I've just discovered binaryen and would love to take advantage of the optimizations. Translating to binaryen IR instead of WAT would simplify things quite a bit. |
This project actually contained bindings for building IR. IIRC, it was not trivial to map to safe Rust and there were no interest in it so that's why it had to go. I would not be opposed to merging a PR that provides a good mapping for it. |
@pepyakin I'm interested in reviving this. Do you happen to remember any more details about why it was not trivial to map to safe Rust? |
It was years and years ago so I don't remember exactly. If I were to guess, then I would assume that it's nothing out of ordinary when it comes dealing with C++ code. E.g. some method has some precondition and if it doesn't hold then the binaryen either aborts (as in I would expect from the bindings to provide a Rust-idiomatic interface. That means, that as long as the user deals with the safe Rust it cannot trigger memory unsafety. It also means the code should panic and not UPD: completely coincedentally I bumped on this discussion, which may indicate kinds of problems I encountered. |
I see that v0.6 is the last version which was wrapping the C api of Binaryen. But it's 6 years old. So a bit old to use. As far as you know, did anybody continue to maintain that? Or do you know of anybody working on creating a Rust wrapper for Binaryen? |
@pepyakin I am trying to create a crate with the binaryen rust bindings. Here a wip The problem as soon as I try to use the binded types, as when uncommenting the test in https://github.com/clacladev/binaryen-rust/blob/dev/src/lib.rs it crashes with:
I am not expert in this FFI Rust stuff. Can you help me on this? |
Hey there!
I want to experiment with extending the gleam language to support compiling to webassembly. The compiler is written in rust, so I was hoping to find rust bindings to the IR construction part of binaryen. Any advice on an approach do explore would be appreciated :)
The text was updated successfully, but these errors were encountered: