Skip to main content

solpipe_keysigner/
example.rs

1use std::ffi::CStr;
2
3#[no_mangle]
4pub extern "C" fn hello(name: *const libc::c_char) {
5    let name_cstr = unsafe { CStr::from_ptr(name) };
6    let name = name_cstr.to_str().unwrap();
7    println!("Hello {}!", name);
8}
9
10#[no_mangle]
11pub extern "C" fn whisper(message: *const libc::c_char) {
12    let message_cstr = unsafe { CStr::from_ptr(message) };
13    let message = message_cstr.to_str().unwrap();
14    println!("({})", message);
15}