5 ms·
Rust FFI is not nearly as simple as Nim's interface to C where you pretty much just call C functions.
by biokoda 11y ago
Rust FFI is not nearly as simple as Nim's interface to C where you pretty much just call C functions.
- vvanders 11y agoThat's exactly Rust's FFI.
- deleted 11y ago[deleted]
- akiselev 11y agoIn its most basic form, yes, but because of Rust's safety guarantees it's not quite that simple. C functions can only be called from unsafe blocks and there is a lot to be desired when you have to pass strings back and forth (I don't know how well Nim handles this). It's also a bit harder to debug an FFI wrapper in Rust when you tell the compiler your code is safe but then make a mistake in how you use the unsafe C api. I strongly prefer Rust's safety but it's not quite the same as a blind FFI like Nim.
- pcwalton 11y ago> It's also a bit harder to debug an FFI wrapper in Rust when you tell the compiler your code is safe but then make a mistake in how you use the unsafe C api. Can you elaborate on to how not having to type unsafe makes debugging of this easier?