[cffi-devel] strange behaviour of CFFI with LW on OS X

Luís Oliveira luismbo at gmail.com
Wed Jun 25 15:14:03 UTC 2008


Hello,

On Wed, Jun 25, 2008 at 4:09 PM, Antoine Allombert
<antoine.allombert at labri.fr> wrote:
>> (cffi:with-foreign-pointer (ptr 2)
>          (setf (cffi:mem-ref ptr :int 0) 0)
>          (setf (cffi:mem-ref ptr :int 1) 1)
>          (let ((i 0))
>          (loop for i from 0 below 2
>          collect (cffi:mem-ref ptr :int i))))

You've allocated 2 bytes and then referenced 2 ints (8 bytes
probably). Try (with-foreign-object (ptr :int 2) ...).

HTH.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/



More information about the cffi-devel mailing list