[cffi-devel] automatic conversion of array of (unsigned-byte 8) to c-string
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
On Sat, Sep 26, 2009 at 10:12 AM, Johan Ur Riise <johan@riise-data.no> wrote:
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))
This used to work but it stopped making much sense when we added support for string encodings. I've fixed the manual and will upload it as soon as I figure out how to build it on OSX. -- Luís Oliveira http://r42.eu/~luis/
On Sat, Sep 26, 2009 at 02:15:28PM +0100, Luís Oliveira wrote:
On Sat, Sep 26, 2009 at 10:12 AM, Johan Ur Riise <johan@riise-data.no> wrote:
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))
This used to work but it stopped making much sense when we added support for string encodings. I've fixed the manual and will upload it as soon as I figure out how to build it on OSX.
Do you mean all the :string conversions, or only :string used with unsigned-byte 8?
On Sun, Sep 27, 2009 at 9:01 AM, Johan Ur Riise <johan@riise-data.no> wrote:
Do you mean all the :string conversions, or only :string used with unsigned-byte 8?
The latter. Cheers, -- Luís Oliveira http://r42.eu/~luis/
participants (2)
-
Johan Ur Riise
-
Luís Oliveira