ck_commands 0.0.5

hello, worldcrate!
Documentation
use crate::commands;
use std::ffi::{CStr, CString};
use std::os::raw::c_char;

#[no_mangle]
pub extern "C" fn hello_world() -> *mut c_char{
    let bytes = commands::hello_world();
    let c_str = CString::new(bytes).unwrap();
    c_str.into_raw()
}

#[no_mangle]
pub extern "C" fn hello_named_world(arg: *const c_char) -> *mut c_char {
    let cstr = unsafe{
        assert!(!arg.is_null());
        CStr::from_ptr(arg)
    };
    let bytes = commands::hello_world_with_args(cstr.to_str().unwrap());
    let c_str = CString::new(bytes).unwrap();
    c_str.into_raw()
}