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 cuda_driver_sys::cuLaunchKernel - Rust

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.