help wanted
仓库指标
- 星标
- (4,472 个星标)
- PR 合并指标
- (平均合并 8分钟) (30 天内合并 3 个 PR)
描述
For a C++ function like this:
void example(const char *s);
it should work to call it as:
use std::ffi::CStr;
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
fn example(s: &CStr);
}
}
fn main() {
let cstr = CStr::from_bytes_with_nul(b"test\0").unwrap();
ffi::example(cstr);
}