CMP doesn't accept `:default` calling convention
Defcallback in the CMP
doesn't accept :default
call convention (supported by libffi), only :cdecl
and :stdcall
.
src/cmp/cmpcbk.lsp
:t3-defcallback
:101 signals an error.
(defun foo () (ffi:defcallback (xxx :cdecl) :void () "hi"))
(compile foo)
(foo)
;; ->#<foreign :POINTER-VOID>
(defun bar () (ffi:defcallback (xxx :default) :void () "hi"))
(compile 'bar)
;; -> * DEFCALLBACK does not support DEFAULT as calling convention
On the other hand :default
is a desired option for android
, beause :cdecl
doesn't seem to work. Everything works fine in the bytecmp
.
Correlated patch to apply to cffi after this is fixed and tested:
diff --git a/src/cffi-ecl.lisp b/src/cffi-ecl.lisp
index 171c630..01dd1d7 100644
--- a/src/cffi-ecl.lisp
+++ b/src/cffi-ecl.lisp
@@ -403,7 +403,7 @@ WITH-POINTER-TO-VECTOR-DATA."
(declare (ignore convention))
(let ((cb-name (intern-callback name)))
`(progn
- (ffi:defcallback (,cb-name :cdecl)
+ (ffi:defcallback (,cb-name :default)
,(cffi-type->ecl-type rettype)
,(mapcar #'list arg-names
(mapcar #'cffi-type->ecl-type arg-types))
Proposed solution: adjust behaviour of both C/C++ compiler and Bytecmp to accept default. Need to check if everything is OK in the C compiler and libffi interop. Verify callback documentation in the newdoc.
Bug discovered by David O'Toole.