On Wed, 15 Jul 2020 at 06:16, Madhu <enom...@meer.net> wrote: > one of the cffi/TODO items has > -> Handle va_list. For now it's treated as any other argument. > > Maybe someone has thought deeply about how to do this? Please let me > know if you have any suggestions. > > [It seems borodust/claw tries to handle this by converting va_list > args to variadic lisp arguments - but it still seems to blow up at a > cffi:parse-type. Or maybe it is a defect with my Clang-7.0 stdarg > vs. what is included with gcc]
The TODO item should probably be removed. DEFCFUN has syntax for varargs and that's implemented on top of FOREIGN-FUNCALL-VARARGS and FOREIGN-FUNCALL-VARARGS-POINTER. The implementation so far is simple, it only takes care of promoting floats to doubles, and chars/short to ints. The test suite tracks whether this works and it seems to work so far. Not sure about what c2ffi needs to do, though. -- Luís Oliveira http://kerno.org/~luis/