[gambit-list] How to copy data from C world into an u8vector?

Phillip Suero philsuero at gmail.com
Fri Nov 13 09:46:41 EST 2020


Dear Marc,

I know if I have a ___STILL u8vector, if I have a blob in the C world, I
can just implement a c-lambda that will memcpy() that blob into the
u8vector's memory addresses.

If the u8vector is not ___STILL however, I cannot do that as the u8vector's
memory address range could change during the memcpy(), is not that so.

Is there any function in Gambit to copy a byte range from a fixed memory
address into a non-___STILL u8vector?  E.g.  (u8vector-raw-copy!
(foreign-address my-c-object) u8vector 0 length)?

Or instead, is the recommendable way to do this, that I make a ___STILL
u8vector, do memcpy() to it in a c-lambda, and then at return i
|u8vector-copy| this u8vector, this way the resultant u8vector is
non-___STILL which is best from the point of view of memory fragmentation?

Your clarification will be much appreciated!

Thanks,
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20201113/076ad353/attachment.htm>


More information about the Gambit-list mailing list