[plt-scheme] internal scheme_memcpy?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Apr 26 22:23:52 EDT 2006

At Wed, 26 Apr 2006 21:59:16 -0400, Jon Rafkind wrote:
> I would like to use the C function memcpy to copy chunks of memory Im 
> using with ffi. On linux this works:
> (define memcpy (get-ffi-obj "memcpy" #f
>                 (_fun _pointer _pointer _int -> _pointer)))
> Probably just because libc is linked in with mzscheme but on windows I 
> get an error because memcpy is not found. Is there a standard internal 
> scheme function that does the same thing as memcpy I can use?

None that I can remember.

You could use `make-sized-byte-string' on both of the arguments, and
then copy with `bytes-copy!'. Unless the objects are relatively long,
though, a lot of the time will be spent allocating and manipulating the
byte-string wrappers (compared to the time for copying).

How about extracting "memcpy" (or is it "_memcpy"?) from "msvcrt.dll"
under Windows?


Posted on the users mailing list.