This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: RFC: variadic closures in x86/x86_64
- From: Andrew Haley <aph at redhat dot com>
- To: "Hogan, D. (GE Power & Water)" <D dot Hogan at ge dot com>
- Cc: Alan Modra <amodra at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>, "libffi-discuss at sourceware dot org" <libffi-discuss at sourceware dot org>
- Date: Wed, 04 Dec 2013 18:50:49 +0000
- Subject: Re: RFC: variadic closures in x86/x86_64
- Authentication-results: sourceware.org; auth=none
- References: <F023C084BCC16446BDA5B664305741E8090811 at ALPMBAPA05 dot e2k dot ad dot ge dot com> <52931854 dot 6080007 at redhat dot com> <20131125093715 dot GU892 at tucnak dot redhat dot com> <5293221D dot 4010505 at redhat dot com> <20131126142723 dot GD9211 at bubble dot grove dot modra dot org> <F023C084BCC16446BDA5B664305741E8091C7D at ALPMBAPA05 dot e2k dot ad dot ge dot com> <529F1E3E dot 4010401 at redhat dot com> <F023C084BCC16446BDA5B664305741E8091DD8 at ALPMBAPA05 dot e2k dot ad dot ge dot com>
On 12/04/2013 06:28 PM, Hogan, D. (GE Power & Water) wrote:
> On Wed, Dec 04, 2013 at 00:07:21AM, Andrew Haley wrote:
>
>> Why do you not define a variadic C function which does this:
>>
>> void f1(int n, ...) {
>> va_list ap;
>
> 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.
> 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.
Andrew.