How do I wrap a C void* buffer into a Scheme u8vector without copying?
Dear Marc, (I'll put the answer to this one in the wiki.) In the C world during a Scheme->C call I have a void* byte buffer with a particular integer length. At return to Scheme I want to return this buffer as an u8vector, for the Scheme-app to be able to do u8vector-set!, -ref etc. on it so that the next time I switch back to C, the C code will have the same void* buffer with the updated results in it. I wish to know: * In the C code, how do I wrap a void* + int len into a u8vector persistent/non-movable scmobj? * How do I ensure that Scheme will just use this u8v as long as Scheme has a reference to it, and then just dispose of it without it doing any free() or other kind of touching on it. Thanks, Mikael
Afficher les réponses par date
participants (1)
-
Mikael