2 ms·
I get the calling into Rust from C via no_mangle + extern. I was looking for the header only C++ to Rust path.
by sitkack 11y ago
I get the calling into Rust from C via no_mangle + extern. I was looking for the header only C++ to Rust path.
- steveklabnik 11y agoHm, I might have misunderstood either you or the OP, then. A C++ header would include the same extern declaration, though it would mark it with the C ABI as well.
- Manishearth 11y agoIt's the same way you call into C from C++. When Rust has a no_mangle extern C function to the universe it's just a C function. Your C++ header just needs to mark the fn as extern C and you're done, you can call it as you would call any other C/++ function.
- sitkack 11y agoOh, I thought there was a magical way to call from C++ into Rust using only a C++ header w/o no_mangle/extern.