Hi all! I’ve been working on this for a few weeks and wanted to share some progress.
It’s a plugin written mostly in the Rust language. Some amount of C++ code is unavoidable, since that’s what the Rack plugin API is built on top of. However, so far I’ve been able to get each module’s process() function implemented almost entirely in Rust, with not too much code boilerplate, and CPU utilization that I think should be equivalent to what you’d get with pure C++.
The way I’ve done this so far is the Rust code independently builds a static library with Cargo (libpotential.a) which the C++ build system links against. As a result, the build steps are a little clumsy because the stock Makefile system quite reasonably expects all of the source files to be C++, so we have to build the Rust code before running any of the Rack-specific make targets.
I haven’t spent a lot of time on creating actual builds, so at the moment there aren’t any releases. I’ll get to that once I’ve cleared out a bit more of the backlog of ideas in my head.
I’ll just answer this with my own personal opinion and hopefully avoid a big language tangent, of which you can infinite variations elsewhere online if you’re so inclined.
I find the language much more pleasant to work in because of features like sum types (or algebraic data types), the borrow checker which keeps me from accidentally doing silly things, and the integrated build and unit test system Cargo provides.
I already work with Rust in my day job, and the cognitive load of writing good C++ isn’t something I want to take on at the moment.
Thank you for your explanation. So for me, not knowing Rust at all, it doesn’t make sense to take a closer look. But I’m generally interested in the modules you are going to develop in Rust and all that yet not unknown problems you may run into.
Here’s my progress so far with building this on Windows. Installed Rust using rustup which allow me to config the x86_64-pc-windows-gnu toolchain. Edited libpotential\makefile to a x86_64-pc-windows-gnu release target.
Searching for the undefined references brings up stuff re: Windows drivers. I’m wondering whether I need to install MSVC build tools as well?
Saying that I am going to install Visual Studio 2022 soon…
I don’t see an immediate fix for that one. Googling around, I see some past discussions (which you’ve probably also found) talking about problems with the x86_64-pc-windows-gnu platform and linker paths. I’ll have to dust off the old Windows box this week to see if I can find a workaround.