From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,235855e3822c83d1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.204.156.202 with SMTP id y10mr25347bkw.1.1334186682118; Wed, 11 Apr 2012 16:24:42 -0700 (PDT) MIME-Version: 1.0 Path: h15ni113014bkw.0!nntp.google.com!news1.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.ecp.fr!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Importing C function with variable argument list Date: Wed, 11 Apr 2012 18:24:33 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <610ee323-4c7f-413d-8568-aed4955f5152@z38g2000vbu.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1334186679 5323 69.95.181.76 (11 Apr 2012 23:24:39 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 11 Apr 2012 23:24:39 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-04-11T18:24:33-05:00 List-Id: "Maxim Reznik" wrote in message news:610ee323-4c7f-413d-8568-aed4955f5152@z38g2000vbu.googlegroups.com... ... > It seems it's impossible to call C function variable argument lists > from Ada. > Even when one knows in advace all arguments at compile time. > > Functions with Variable Argument Lists have their own ABI. For > instance, in x86_64: > >> When a function taking variable-arguments is called, %rax must be set to >> the >> total number of floating point parameters passed to the function in >> vector registers. This is news to me! This is definitely not the case in the 32-bit interfaces with which I'm familar, so I'm not surprised that neither Ada nor implementers ever worried about this case. (Janus/Ada doesn't have any special handling for this case, and I've never seen any need for it, either.) The "intended" solution would be for the language-name to be some implementation-defined name that specifies this ABI (much like "StdCall" specifies the "standard" ABI on Windows). That's necessarily not portable across implementations, but then again these sorts of bindings are almost never 100% portable. Randy.