Re:Compiling C to Safe Rust, Formalized
by LPisGood on Saturday December 21, 2024 @03:32PM
(#42482090)
I know Unity game engine uses some transpiler called IL2CPP that manages to preserve some of the safety features of C# but still gets the speed of CPP, so one direction is definitely possible
[ Parent
| on HN ]
Re:Compiling C to Safe Rust, Formalized
by neonsunset on Saturday December 21, 2024 @06:06PM
(#42483064)
Oh, it's mainly for platform compatibility. IL2CPP performance is really problematic since it still carries many issues of Mono, even if transpiled to C++: https://meetemq.com/2023/09/18/is-net-8-performant-enough/ (don't look at just the starting graph - make sure to scroll down to notes where RyuJITs code competes with other fast entries or even outperforms them).
Perhaps what you were looking for is NativeAOT? Either way C ports really well to C# since it supports a large subset of it "as is" and then some with generics and other features originating from C# itself.