This is the mail archive of the mailing list for the libffi project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: RFC: variadic closures in x86/x86_64

On Wed, Dec 04, 2013 at 00:01:51PM, Andrew Haley wrote:
> > In the libffi manual, there's a TODO about variadic closures.
> That's AFAIK to do with targets that have a different calling
> convention for variadic calls.

Ok, this is the source of my confusion then.  I thought the manual was
saying you wanted libffi to be able to create closures that could
iterate through variadic arguments they were called with.

> > My interpretation of variadic closures is a closure which can access
> > variadic arguments without sending in the number of arguments and
> > types at the ffi_prep_cif or ffi_prep_cif_var time.  Once you have a
> > variadic closure, you should be call it any number of times with any
> > number of variadic arguments.
> Forgive me, but that's not an answer.  I have provided an example of a
> mechanism that JNA could use that would not require us to change
> libffi.  Couldn't you do this in JNA?  It doesn't have to be
> application-specific.

I'm sure it would work.  A similar suggestion is mentioned in the CFFI
documentation.  It would require a C function for every assumed
variadic processing convention.  For instance, FMI requires
#<Type><valueReference># which is not a typical printf/logger
convention. I didn't go down that path because I thought the manual
was asking for patches for a different way.

Thanks for the feedback.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]