Maraiah/tycho/source/cc.rs

22 lines
409 B
Rust
Raw Normal View History

2019-06-30 22:25:54 -07:00
//! C++ functions.
mod ffi {
2019-07-05 20:21:11 -07:00
extern "C" {
pub fn critical_msg(title: maraiah::ffi::NT, msg: maraiah::ffi::NT);
}
2019-06-30 22:25:54 -07:00
}
pub fn critical_msg<T, U>(title: T, msg: U)
2019-07-05 20:21:11 -07:00
where T: ToString,
U: ToString
2019-06-30 22:25:54 -07:00
{
2019-07-05 20:21:11 -07:00
let title = std::ffi::CString::new(title.to_string()).unwrap();
let msg = std::ffi::CString::new(msg.to_string()).unwrap();
2019-06-30 22:25:54 -07:00
2019-07-05 20:21:11 -07:00
unsafe {
ffi::critical_msg(title.as_ptr(), msg.as_ptr());
}
2019-06-30 22:25:54 -07:00
}
// EOF