consistency: defcallback always returns just pointer, not a list

Fixes #223.
This commit is contained in:
Daniel Kochmanski 2017-09-30 12:23:57 +02:00
parent 6baadf2a06
commit fe392867c3
3 changed files with 5 additions and 7 deletions

View file

@ -903,7 +903,7 @@ si_free_ffi_closure(cl_object closure)
closure);
si_set_finalizer(closure_object, @'si::free-ffi-closure');
cl_object data = cl_list(6, closure_object,
cl_object data = cl_list(5,
fun, return_type, arg_types, cc_type,
ecl_make_foreign_data(@':pointer-void',
sizeof(*cif), cif),
@ -911,13 +911,13 @@ si_free_ffi_closure(cl_object closure)
(n + 1) * sizeof(ffi_type*),
types));
int status = ffi_prep_closure_loc(closure, cif, callback_executor,
ECL_CONS_CDR(data), executable_region);
data, executable_region);
if (status != FFI_OK) {
FEerror("Unable to build callback. libffi returns ~D", 1,
ecl_make_fixnum(status));
}
si_put_sysprop(sym, @':callback', data);
si_put_sysprop(sym, @':callback', closure_object);
@(return closure_object);
} @)
#endif /* HAVE_LIBFFI */

View file

@ -41,11 +41,9 @@
`(progn
(defun ,name ,(reverse arg-variables) ,@body)
(si:put-sysprop ',name :callback
(list
(ffi:c-inline () () :object
,(format nil "ecl_make_foreign_data(@':pointer-void,0,(void*)~a)" c-name)
:one-liner t)))))
)))
:one-liner t)))))))
(defconstant +foreign-elt-type-codes+
'((:char . "ECL_FFI_CHAR")

View file

@ -770,7 +770,7 @@ Loads a foreign library."
(let ((x (si::get-sysprop name :callback)))
(unless x
(error "There is no callback with name ~a" name))
(first x)))
x))
;;;----------------------------------------------------------------------
;;; COMPATIBILITY WITH OLDER FFI