MoonBit Foreign Function Interface.
Dependencies
///|
test {
let c_name = @proton_ffi.to_cstr("ffi")
assert_eq(c_name, b"ffi\x00")
assert_eq(@proton_ffi.from_cstr(c_name), "ffi")
let wide_name = @proton_ffi.to_wstr("世界")
assert_eq(@proton_ffi.from_wstr_lossy(wide_name), "世界")
}fn from_cstr(b : Bytes) -> Stringlet raw = @proton_ffi.to_cstr("hello")
inspect(@proton_ffi.from_cstr(raw), content="hello")fn from_wstr_lossy(b : Bytes) -> Stringlet raw = @proton_ffi.to_wstr("Hello")
inspect(@proton_ffi.from_wstr_lossy(raw), content="Hello")fn to_cstr(s : String) -> Bytesinspect(@proton_ffi.to_cstr("ffi"), content=b"ffi\x00")fn to_wstr(s : String) -> Bytesinspect(@proton_ffi.to_wstr("Hi"), content=b"\x48\x00\x69\x00\x00\x00")MoonBit Foreign Function Interface.
Dependencies