avmnif-rs 0.4.1

Safe NIF toolkit for AtomVM written in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use alloc::ffi::CString;
use core::ffi::c_char;  // <-- Add this import

extern "C" {
    fn avmnif_log(msg: *const c_char);  // <-- Use c_char instead of i8
}

pub fn log_info(msg: &str) {
    let cstr = CString::new(msg).expect("log message contained null byte");
    unsafe {
        avmnif_log(cstr.as_ptr());  // <-- No cast needed now
    }
}