* Martin Simmons <mar...@lispworks.com> <202007161039.06gadkkb016...@higson.cam.lispworks.com> Wrote on Thu, 16 Jul 2020 11:39:20 +0100 >>>>>> On Thu, 16 Jul 2020 11:42:17 +0530 (IST), Madhu said: >> In order to "treat va_list as any other argument" I tried adding an >> opaque (cffi:defcstruct (:builtin-va-list :size 192)) -- 192 being >> sizeof(va_list) with x86_64-pc-linux-gnu-gcc -- having >> %json-type-to-cffi-type return that when it comes across a cffi tag >> "__builtin_va_list". cffi/c2ffi can generate defcfns for functions >> which use va_list in the signature. I think the user would still be >> hardpressed to find a way to use them. > > I think this defcstruct is wrong on x86_64-pc-linux-gnu-gcc for two reasons: > > 1. sizeof(va_list) is 24 bytes for me. > > 2. It is an array, not a struct, so it is passed as a pointer. > > I.e. > > int bar(va_list z) > { > return sizeof(z); > } > > will return the same as sizeof(void *).
mea culpa on both counts. i see it is defined be an array type so it is always handled as a pointer.