currently I’m writing a small library that should be callable from C.
However I have a small understanding problem on how to “free” the memory afterwards.
So you’d create another function free_information that uses Box::from_raw to convert a raw pointer to Box pointer (and then you don’t have to free the box — Rust will do it automatically).
For an allocated array of bytes, you’d probably want Box<[u8]> (it’s simpler than Vec, which also has capacity).
ah well that’s what I thought already (but good to have a confirmation for that). I think what I missed is that *const u8 and *mut u8 are “basically” the same, i.e. I can just call let ptr = value as *mut u8 or let ptr = value as *const u8. (It’s impossible to call from_raw_parts_mut or from_raw onto a *const u8)