<div dir="ltr"><div dir="ltr"><div>Hi Marc,</div><div><br></div><div dir="ltr">What the OP mentions would ideally be offered through a form something like |ffi-copy-to-u8vector|, is it not? Wrote this up as a feature request here now <a href="https://github.com/gambit/gambit/issues/645">https://github.com/gambit/gambit/issues/645</a> .<br></div><div dir="ltr"><br></div><div>Best regards,<br>Adam</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 13 Nov 2020 at 15:54, Phillip Suero <<a href="mailto:philsuero@gmail.com">philsuero@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Ah right - allocating an u8vector in the Scheme world is always preferable over allocating while in the C world (via ___alloc_scmobj() right), isn't it so?<br><br>And this is because allocating an object may involve a heap overflow exception, a resumed allocate attempt, a garbage collection, all these complexities are only offered by |##make-u8vector| defined in lib/_kernel.scm, which is very much preferable to invoke in a pure Scheme setting, is it not so<br><br>Thanks,<br>Phil<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 13, 2020 at 11:46 AM Phillip Suero <<a href="mailto:philsuero@gmail.com" target="_blank">philsuero@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear Marc,<br><br>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.<br><br>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.<br><br>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)?<br><br>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?<br><br>Your clarification will be much appreciated!<br><br>Thanks,<br>Phil<br></div>
</blockquote></div>
_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca" target="_blank">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list" rel="noreferrer" target="_blank">https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list</a><br>
</blockquote></div>