c_char is the libc type used for a platform-specific C char in Rust foreign-function interfaces. Import it from libc when matching a C function signature. section 3.2
A C function accepting char * becomes a Rust function accepting *const c_char when it only reads the character data. The pointer type records that distinction in the signature. section 3.2
Matching a C function signature
use libc::{c_char, c_int}; fn solve(line: *const c_char, solution: *mut c_int) -> c_int { 0 } Here, c_char represents the C character type, while the raw pointer expresses the incoming character buffer used by the foreign-function boundary. section 3.2.1 section 3.2
Listing 3.4 The most basic solve function in Rust that compiles
use libc::{c_char, c_int}; #1
fn solve(line: *const c_char, solution: *mut c_int) -> c_int {
0 #2
}
Inspect the smallest compiling Rust function that imports c_char and uses it in a C-compatible pointer parameter. section 3.2.1
