Hi,

How do I call a function that expect char**?

I test it with

/** C Code */
#include <stdio.h>

void expect_charpp(char** buffs){
  printf("I got %s and %s", buffs[0], buffs[1]);
}


;; Lisp side
(cffi:with-foreign-object (argv :pointer 2)
           (setf (cffi:mem-ref argv :pointer 0)
(cffi:foreign-string-alloc "Hello"))
           (setf (cffi:mem-ref argv :pointer 1)
(cffi:foreign-string-alloc "Hello"))
           (cffi:foreign-funcall "expect_charpp" :pointer argv))

And I got a memory fault error in SBCL.
If i comment out the code in C to make it not accessing the data, it
won't err. So it looks like the error is in how I allocate the memory.

Please advice.

Pisin Bootvong,
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to