[cffi-devel] automatic conversion of array of (unsigned-byte 8) to c-string

Johan Ur Riise johan at riise-data.no
Sat Sep 26 09:12:42 UTC 2009


this is exactly the example from the manual:

(let ((str (make-array 4 :element-type '(unsigned-byte 8)
                       :initial-element 65)))
  (foreign-funcall "strlen" :string str :int))


but my lisp says:

#(65 65 65 65) is not a Lisp string or pointer.
   [Condition of type SIMPLE-ERROR]

What is going on?

This works as expected:

(let ((str (make-array 4 :element-type 'character
                       :initial-element (code-char 65))))
  (foreign-funcall "strlen" :string str :int))

=> 4



I run clozure cl on windows 32







More information about the cffi-devel mailing list