C:\lispbox\ccl>wx86cl.exe Welcome to Clozure Common Lisp Version 1.3 (WindowsX8632)! ? (load "init.lisp") #P"C:/lispbox/ccl/init.lisp" ? (asdf:oos 'asdf:load-op :cffi) ; loading system definition from C:/lispbox/packages/cffi/cffi.asd into # ; registering # as CFFI ; loading system definition from C:/lispbox/packages/babel/babel.asd into # ; registering # as BABEL ; loading system definition from C:/lispbox/packages/alexandria/alexandria.asd into # ; registering # as ALEXANDRIA ; loading system definition from C:/lispbox/packages/trivial-features/trivial-features.asd into # ; registering # as TRIVIAL-FEATURES NIL ? (asdf:oos 'asdf:load-op :cffi-tests) ; loading system definition from C:/lispbox/packages/cffi/cffi-tests.asd into # ; registering # as CFFI-TESTS ; loading system definition from C:/lispbox/packages/rt/rt.asd into # ; registering # as RT ;Compiler warnings for "C:/lispbox/packages/cffi/tests/funcall.lisp" : ; In (EXPAND-TO-FOREIGN (T CHECK-NIL-SKIP-TYPE)): Unused lexical variable VAL ; Warning: COMPILE-FILE warned while performing # on #. ; While executing: #, in process listener(1). NIL ? (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)))) QSORT-CALLBACK ? (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))))) TEST-CALLBACKS-WITH-QSORT ? (test-callbacks-with-qsort) (1 2 3 4 5 6 7 8 9 10) ?