Many thanks @tbu. I looked for #[repr©] and found http://doc.rust-lang.org/guide-ffi.html. Which I have perused leading to additional questions.
Contiguous buffers and lengths can be passed portably. For example
fn snappy_validate_compressed_buffer(
compressed: *const u8,
compressed_length: size_t) -> c_int
Is there a way short of writing a wrapper to explain the type system that the two parameters are interdependent?
How about passing a Rust string to a C function expecting a zero-terminated string? More importantly I am concerned with passing more complex structures such as hash tables across the languages. It seems some marshaling is needed, is there a standard mechanism for marshaling?
A full C++ compiler should not be needed for proper name mangling and ABI. Are there any plans for the Rust designers to enhance C++ support in Rust? (@huon that’s why I asked here. I am interested in future outlook as much as what is available right now.)