[cffi-devel] stdcall callbacks on ClozureCL/win32
Luís Oliveira
luismbo at gmail.com
Sat Jun 6 23:22:33 UTC 2009
On Sat, Jun 6, 2009 at 10:14 PM, Greg Santucci<thecodewitch at 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)))))
--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
More information about the cffi-devel
mailing list