3 ms·
So, when Rust is actually in the kernel would it be possible for some C based routines to call them? Like the article seems to mention things I've seen as "help
by djbusby 4y ago
So, when Rust is actually in the kernel would it be possible for some C based routines to call them? Like the article seems to mention things I've seen as "helper" functions, so a mostly C module can get some memory safe benefits? Or do whole components need to be rewritten?
- borodi 4y agoTheoretically yes, rust binaries can have C-apis and other code can call them just fine.
- kibwen 4y agoWith the caveat that, naturally, these APIs can only expose concepts that C can understand, so you're a bit limited. No generics, for example.
- maximilianburke 4y agoYep! At our company, for example, we have built a plugin for PAM in Rust which exposes all the necessary functions with a C interface.
- hpb42 4y agoThis sounds really interesting! Is the source available somewhere?
- spullara 4y agoThe RUST FFI is just the C function interface. You can completely fool the C code that you are also C code.
- steveklabnik 4y agoNot only is it possible, being able to do so well is a design constraint on the language.