Convert to *mut std::ffi::c_void

    let mut n = 10_i32;
    let p_n = &mut n as *mut std::ffi::c_void;

How do I make the above compile ?

Context: I am trying to call https://docs.rs/cuda-driver-sys/0.3.0/cuda_driver_sys/fn.cuLaunchKernel.html

You need to cast to pointer first, then cast to void pointer:

let p_n = &mut n as *mut _ as *mut std::ffi::c_void;
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.