[cffi-devel] Re: Need foreign string method for translate-into-foreign-memory?
Stelian Ionescu
sionescu at cddr.org
Sat Oct 19 22:53:05 UTC 2013
On Sat, 2013-10-19 at 15:28 -0400, Liam Healy wrote:
> On Thu, Oct 17, 2013 at 9:14 AM, Luís Oliveira <luismbo at gmail.com> wrote:
>
> > Anyway, a test using libtest (or some standard C function, if we can
> > force libffi to kick in for functions that don't use structures) would
> > be nice. Do you have the time/inclination to give it a go?
>
> How about this? In fsbv.lisp
>
> ;;; Combine structures by value with a string argument
> (deftest fsbv.7
> (stringlenpair "abc" '(1 . 2))
> (3 . 6))
>
>
> and in libfsbv.c
>
> DLLEXPORT
> struct struct_pair stringlenpair (char * string, struct struct_pair dp)
> {
> struct struct_pair ret;
> ret.a = strlen(string)*dp.a;
> ret.b = strlen(string)*dp.b;
> return ret;
> }
>
> Can you run this and see if it works? I've never figured out how to run tests.
(asdf:test-system :cffi)
--
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20131020/e1420272/attachment.sig>
More information about the cffi-devel
mailing list