4 ms·
The continuing improvements to procedural macros are great! I do a fair amount of integration with C, and the work the rust team is doing for procedural macros
by jeffdavis 7y ago
The continuing improvements to procedural macros are great!
I do a fair amount of integration with C, and the work the rust team is doing for procedural macros has helped a lot. Being able to use them in an extern blocks will surely help more.
Like many, I have a wish list that I complain about sometimes, but I feel bad about complaining because rust has done so much to improve my use case I don't know where to begin. I should write up a blog post about all of the difficulty I had, and how each release since around 1.28 has introduced features that solved these problems one by one.
To me, Rust/C interop is the killer feature. Not only is it a low-level language that can be used instead of C, it can also be used to extend C applications. I'm sure it was not easy to do this well, but what a great strategic decision by the rust team to spend the effort on it!
- joshbenford89 7y agoCan you recommend any good blog or tutorial on integrating C/Python and newer releases of Rust?
- jeffdavis 7y agoI didn't use much except for the official docs (book and reference). Googling around shows some promising material. Release notes are helpful -- when you see something added related to C, it's a strong hint to read about the new feature. Macro features are important because rust has sophisticated macros and C macros are closer to text replacement. So when trying to emulate a C header, you need to do a lot of macro magic in rust sometimes. Sorry that I don't have more to offer from personal experience.
- calibas 7y agoHere's a common Rust foreign function interface for Python, with quite a few examples: https://crates.io/crates/pyo3 https://crates.io/crates/pyo3 Here's the one for C: https://crates.io/crates/libc https://crates.io/crates/libc