3 ms·
It's quite the opposite. Wrapping existing C code in Rust FFI can make it safer. Rust side can add missing type information to C interfaces. Things that are "R
by pornel 7y ago
It's quite the opposite. Wrapping existing C code in Rust FFI can make it safer.
Rust side can add missing type information to C interfaces. Things that are "RTFM" for C, such as thread safety of the types involved and which function arguments are borrowed/owned, can be expressed on the Rust side even for C code, and automatically enforced when it's used via FFI. This adds a layer of safety to existing C code.
- jstewartmobile 7y ago"Using C libraries in a portable way involves a bit of work: finding the library on the system or building it if it's not available, checking if it is compatible, finding C headers and converting them to Rust modules, and giving Cargo correct linking instructions. Often every step of this is tricky..." Adding loads of complexity (i.e. more opportunities to screw something up) for a minor gain.
- pornel 7y agoNote that this mess isn't created by Rust. The difficulty of building arbitrary C libraries on all platforms comes from C.