OK. On superficial examination, it seems like foreign-string-alloc and lisp-string-to-foreign have significant duplicated code. Is there a reason for that rather than having the former call the latter?

Thanks,
Liam


On Tue, Oct 1, 2013 at 4:43 AM, Luís Oliveira <loliveira@common-lisp.net> wrote:
On Tue, Oct 1, 2013 at 4:17 AM, Liam Healy <lnp@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/