|
|
|
|
|
by zozbot234
2388 days ago
|
|
> When converting C to Rust you have to do things on a module by module or compile artifact by compile artifact basis, which makes it much more challenging. OP is essentially about proving the opposite. It does take a bit of setup to get there, but you can ultimately translate C to Rust on a function-by-function basis, and Rustify interfaces, data structures, etc. only gradually after nothing on the C side is relying on the older defs. C++ would be more of a challenge - you need to forgo quite a few C++-exclusive features to end up with interfaces that Rust can work with. That's where an "artifact by artifact" approach might work better. Other languages would be roughly similar, with their heavyweight C FFI's. |
|
Luckily, many C++ projects do this already so they can be called from C.