Working with c_void in an FFI
You can’t cast a struct to c_void, but you can cast a reference to the struct to *mut c_void and back using some pointer casts: fn my_callback(con: *tsm_screen, …, data: *mut c_void) { // unsafe is needed because we dereference a raw pointer here let data: &mut State = unsafe { &mut *(data as *mut … Read more