Hi all, i am writing a wrapper to an SQLite database.
If i use : extern { fn sqlite3_open(filename: *c_char, ppDb : **mut ()) -> c_int; } i can not use : let ppDb : **mut () = RawPtr::null(); unsafe { res=sqlite3_open(filename.as_ptr(), ppDb); because as_ptr() returns an *u8 and c_char is a i8, so i have to use extern { fn sqlite3_open(filename: *c_uchar, ppDb : **mut ()) -> c_int; } Now, suppose i use : extern { fn sqlite3_errmsg(pDb : *mut ()) -> *c_uchar; } i can not use : let mut desc=""; { unsafe { desc = c_str_to_static_slice(sqlite3_errmsg(*ppDb)); } } because c_str_to_static_slice taks a *c_char (so an i8) as argument, so i have to use extern { fn sqlite3_errmsg(pDb : *mut ()) -> *c_char; } If the second example is quite logical, what about the first one ? how to convert &str -> *c_char ? thanks -- Christophe http://chris-pe.github.io/Rustic/
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev