-
Notifications
You must be signed in to change notification settings - Fork 321
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
[RFC] Future directions for cbindgen #214
Comments
I just want to add the two use case I see: milksnake is currently I also wonder whether the rls wood be a good fit here as a stable abstraction over the compiler. This would afaik also avoid pulling rustc in. |
I looked into I've also been pointed to [1] https://github.com/nrc/rls-rustc |
I've read your blog article and I am very interested by the This is why I'm suggesting that the format for For example, if something implements Iterator, then this knowledge can be used by a Lua binding generator to add the specific flags to the type so that it can be used directly in a Lua for loop. I suggested adding trait data, but I'm not sure this would be the best thing to have the most general-purpose thing possible. It has the merit of being relatively easy to implement, but it might also miss some other information on the code (for example methods associated with structs). What do you think of this idea? |
@Moxinilian One of my original goals with cbindgen was to eventually extend it to generate idiomatic C/C++ code for idiomatic Rust code. Roughly supporting rust things like iterators, drop, rc, box, inherent impl methods with idiomatic C/C++ wrappers. So I'd love for this to be done (even better for more languages than just C/C++), but it's been more or less dropped in the focus to just get FFI semantics correct. I think we could do a couple things with a
What I like about this approach is that it moves the problem from the rustc plugin to proc-macros and binding generators. Otherwise I'd be concerned about the churn in the plugin and the ffi.json format. |
I just want to add rust-analyzer here because it could solve the problems stated in the blog post without requiring rustc itself. |
I discussed with the rust-analyzer folks and while they would love to be a viable solution for cbindgen's issues in the long-term, they just won't be ready to do so for a while. |
I've wrote a blog post talking about some old persistent issues in cbindgen coming from the original architecture [1], and a potential forward path [2].
This would solve:
serde_derive
#203use
aliases #7pub use
#139And probably others. Comments and feedback are welcome!
[1] http://dreamingofbits.com/post/future-directions-for-cbindgen-rust-ffi/
[2] https://github.com/eqrion/rust-ffi
The text was updated successfully, but these errors were encountered: