diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-06-09 20:15:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-06-09 20:15:13 -0700 |
commit | bb67d9260a1ae939f53af5c593314cf275480cd2 (patch) | |
tree | 664a59f21031c4fc032941f8512cf675178fa500 /share | |
parent | 268ad25b4a88a50b83c1f2e8c2eb4a4436e52b3d (diff) | |
download | txr-bb67d9260a1ae939f53af5c593314cf275480cd2.tar.gz txr-bb67d9260a1ae939f53af5c593314cf275480cd2.tar.bz2 txr-bb67d9260a1ae939f53af5c593314cf275480cd2.zip |
ffi: bug: always using ffi_prep_cif_var.
* share/txr/stdlib/ffi.c (deffi): Fix misnamed variable.
The second value coming from sys:analyze-argtypes is the number of fixed
arguments, not the number of variadic arguments. Furthermore, if this
number is equal to nargs, we were supposed to have been passing nil
instead to ffi-make-call-desc, which indicates the ordinary non-variadic
function. We were always always passing a non-nil value, so always requesting
variadic. That is fixed now thanks to the change to ffi_make_call_desc.
* ffi.c (ffi_make_call_desc): Register the function as variadic if
either nfixed is specified as nil, or if it is equal to ntotal.
* txr.1: Document the convention change for ffi-make-call-desc.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/ffi.tl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/share/txr/stdlib/ffi.tl b/share/txr/stdlib/ffi.tl index 73ee1936..dbf7888c 100644 --- a/share/txr/stdlib/ffi.tl +++ b/share/txr/stdlib/ffi.tl @@ -74,12 +74,12 @@ (arg-types-sym (gensym "arg-types-")) (call-desc-sym (gensym "call-desc-")) (fun-sym (gensym "ffi-fun-"))) - (tree-bind (nargs nvariadic . argtypes) (sys:analyze-argtypes f argtypes) + (tree-bind (nargs nfixed . argtypes) (sys:analyze-argtypes f argtypes) (let ((arg-syms (take nargs (gun (gensym))))) ^(progn (defvarl ,ret-type-sym (ffi-type-compile ',rettype)) (defvarl ,arg-types-sym [mapcar ffi-type-compile ',argtypes]) - (defvarl ,call-desc-sym (ffi-make-call-desc ,nargs ,nvariadic + (defvarl ,call-desc-sym (ffi-make-call-desc ,nargs ,nfixed ,ret-type-sym ,arg-types-sym ',name)) |