[gambit-list] How do I wrap a C void* buffer into a Scheme u8vector without copying?
Mikael
mikael.rcv at gmail.com
Tue Apr 12 07:42:01 EDT 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20110412/b9789e19/attachment.htm>
More information about the Gambit-list
mailing list