greyblake / whatlang-ffi

C bindings for whatlang Rust library
MIT License
9 stars 2 forks source link

Check NULL pointer #5

Closed greyblake closed 3 years ago

greyblake commented 7 years ago

Details are in this comment: https://www.reddit.com/r/rust/comments/6sosp0/porting_a_rust_library_to_c/dleg19i/

Also, that whatlang_detect argument should be char const text. And you should not map struct whatlang_info to &mut Info: C allows null pointers, Rust does not. The Rust side should be *mut Info with an explicit check for null.