logoalt Hacker News

SkiFire13 • today at 7:15 PM • 2 replies • view on HN

It's not a strict prerequisite, you can just require the library being distributed to use extern "C".


Replies

gspr • today at 7:25 PM

Well yes, but then your interface is a C ABI. That's fantastic if the side using my library is any language where C is the only common ground. When the application side is Rust though, it leaves a lot to be desired. It would be delicious to actually interface in a way that respects Rust!

Hell, even if all exposed functions and types would need to be fully monomorphized at the interface, it would be a lot nicer to pass a `&'a [i64]` rather than a `const * int64_t` together with a `size_t n` and have to marshall the slice on both sides.

Xirdus • today at 8:13 PM

Or to put it another way, it is a strict prerequisite and Rust already meets it via extern "C".