How to change Box to ptr

pub fn test_transfer_buffer_to_gpu(gpu_context: &Arc<GpuContext>, data: &Box<[u8; 64 * 16]>) {
    unsafe {
        transfer_char_to_gpu(
            &mut gpu_context.stream_context.clone(),
            &mut gpu_context.cuda_mem_context.clone(),
            *data.as_ptr()
        )
    }
}
error[E0308]: mismatched types
   --> src/cudalib.rs:180:13
    |
180 |             *data.as_ptr()
    |             ^^^^^^^^^^^^^^ expected *-ptr, found `u8`
    |
    = note: expected raw pointer `*const u8`
                      found type `u8`

You already get the pointer, you just don't need to dereference it - change *data.as_ptr() to simply data.as_ptr().

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.