From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16798 invoked by alias); 31 Oct 2009 18:29:10 -0000 Received: (qmail 16788 invoked by uid 22791); 31 Oct 2009 18:29:09 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 31 Oct 2009 18:29:05 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9VIT3I7031854; Sat, 31 Oct 2009 14:29:03 -0400 Received: from zebedee.pink (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9VIT137018476; Sat, 31 Oct 2009 14:29:02 -0400 Message-ID: <4AEC81EC.3020409@redhat.com> Date: Sat, 31 Oct 2009 18:29:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: Adrien CC: libffi-discuss@sourceware.org Subject: Re: [libffi] variable arguments support References: <666572260910301305s70f75aefnd73ede1cbd65f59b@mail.gmail.com> In-Reply-To: <666572260910301305s70f75aefnd73ede1cbd65f59b@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org X-SW-Source: 2009/txt/msg00334.txt.bz2 Adrien wrote: > I am trying to call a function with variable arguments. The libffi > README in gcc-4.3 sources mentionned this wasn't possible yet. The > more recent libffi sources (latest tarball available) mention: > >> There is no support for calling varargs functions. This may work on >> some platforms, depending on how the ABI is defined, but it is not >> reliable. > > Should I read that as "if this work for you, try lotto" or has there > been some actual effort towards that? > I tried a small test program on linux32, linux64 and sparc32 and it > worked each time. The code is available on vpaste.net[1] (simple > pastebin). I tried to make it long enough to trigger potential > problems but I don't know that much low-level stuff and I'm not sure > I'm testing for the right thing. > > I'd like comments about this. I don't need extensive support but I > need at least linux32/64, win32/64 and (various) bsd (I'm writing a > desktop app). I have never knowingly used any ABI that has a different calling convention for varargs and non-varargs functions. Such ABIs probably exist, but I wouldn't worry too much about the possibility. Andrew.