3 ms·
"the libc is written in Rust" This is cool, are there any downsides to calling Rust code from C? I guess it's basically a black box that behaves like a regular
by p1necone 6y ago
"the libc is written in Rust"
This is cool, are there any downsides to calling Rust code from C? I guess it's basically a black box that behaves like a regular C library from the outside?
- davidhyde 6y agoNo downsides except that the public rust function needs to be decorated with the #[no_mangle] attribute for it to be consumed by a c or c++ codebase.
- _-___________-_ 6y agoIt is a regular .so (what I assume you mean by "C library"), not a "black box that looks like a regular .so". There's no runtime wrapped around your code like with Go etc. You just need to add an attribute to tell the compiler not to mangle your names, similar to what's needed for C++ / C interop.