4 ms·
It's not that Rust has a C API, it's that Rust has a simple means by which you can mark a function as using the C calling convention, and export this function a
by eridius 11y ago
It's not that Rust has a C API, it's that Rust has a simple means by which you can mark a function as using the C calling convention, and export this function as a symbol from your library, which lets anything else that speaks the C calling convention (e.g. C, or plenty of other languages) invoke that function.
- Ygg2 11y agoYeah, I did say exposes C API. It's what most crates that have it, call it.
- eridius 11y agoSaying that a particular crate has a C API makes sense. Saying that Rust has a C API suggests that Rust has some equivalent to e.g. Python or Ruby's C APIs that let you invoke arbitrary Rust code from C, which isn't true.