[cffi-devel] Re: Need foreign string method for translate-into-foreign-memory?

Liam Healy lnp at healy.washington.dc.us
Sat Oct 19 19:28:04 UTC 2013


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.

Thanks,
Liam



More information about the cffi-devel mailing list