Need foreign string method for translate-into-foreign-memory?

Luís Oliveira loliveira at common-lisp.net
Tue Oct 1 08:43:25 UTC 2013


On Tue, Oct 1, 2013 at 4:17 AM, Liam Healy <lnp at healy.washington.dc.us> wrote:
> Based on this report http://paste.lisp.org/display/139232 it seems like we
> need a method translate-into-foreign-memory for foreign-string in order that
> cffi-libffi works when there are both structures by value and strings in the
> arguments (or return). I looked at the code for translate-to-foreign for
> inspiration, but I'm not clear on how strings work. Is this simply a memcpy?

Not quite a memcpy since we need to convert from Lisp characters to
one or more bytes depending on the desired target encoding.
LISP-STRING-TO-FOREIGN is the function for job.

Cheers,

-- 
Luís Oliveira
http://kerno.org/~luis/



More information about the cffi-devel mailing list