You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Passing foreign structures by value to variadic functions will not work since cffi-libffi doesn't support it. CFFI needs to define ffi_prep_cif_var and update code to use it. This issue will exist until then and is technically a CFFI bug.
What this means is functions similar to printf that allow arbitrary number of function parameters like al:draw-textf won't work if one of the parameters is a struct (pointers remain fine).
;; tc is a struct returned by al:map-rgba-f;; not a "struct pointer", an "actual struct"
(let ((tc (al:map-rgba-f 0000.5))
(font (al:create-builtin-font)))
;; The "Hello world!" is the extra parameter
(al:draw-textf font tc 880"%s""Hello world!))
Workaround
Sometimes a workaround is possible like replacing calls to al:draw-textf with al:draw-text and the built-in FORMAT to achieve the same thing:
;; al:draw-textf is drawing text like printf;; we can do the same thing with FORMAT
(al:draw-text font tc 880 (formatnil"Filename: ~a" filename))
The text was updated successfully, but these errors were encountered:
resttime
changed the title
Passing foreign structures by value to variadic functions
Passing FSBV to variadic functions (al:draw-textf and etc.)
May 4, 2020
Description
Passing foreign structures by value to variadic functions will not work since cffi-libffi doesn't support it. CFFI needs to define
ffi_prep_cif_var
and update code to use it. This issue will exist until then and is technically a CFFI bug.What this means is functions similar to
printf
that allow arbitrary number of function parameters likeal:draw-textf
won't work if one of the parameters is a struct (pointers remain fine).Workaround
Sometimes a workaround is possible like replacing calls to
al:draw-textf
withal:draw-text
and the built-inFORMAT
to achieve the same thing:The text was updated successfully, but these errors were encountered: