On Sun, Jun 7, 2009 at 9:22 AM, Luís Oliveira <luismbo@gmail.com> wrote:
On Sat, Jun 6, 2009 at 10:14 PM, Greg Santucci<thecodewitch@gmail.com> wrote:
> The transcript is in the attached file "latest-cffi-test.txt".

So it seems like CCL crashes in the CALLBACKS.QSORT test (in
cffi/tests/callbacks.lisp) somewhere within the call to qsort(). I
would guess there is some bug related to callbacks. Try this:

(ccl:defcallback qsort-callback (:address a :address b :signed-int)
 (let ((x (ccl:%get-signed-long a))
       (y (ccl:%get-signed-long b)))
   (cond ((> x y) 1)
         ((< x y) -1)
         (t 0))))

(defun test-callbacks-with-qsort ()
 (ccl:%stack-block ((array 40))
   (loop for i from 0
         and n in '(7 2 10 4 3 5 1 6 9 8)
         do (setf (ccl:%get-signed-long array (* i 4)) n))
   (ccl:external-call "qsort" :address array :signed-int 10 :signed-int 4
                      :address qsort-callback :void)
   (loop for i from 0 below 10
         collect (ccl:%get-signed-long array (* i 4)))))

That seems to work!

The output is in the attached file,  good-cffi-results.txt

Does this mean cffi can be patched again?

Regards,
Greg