From: Adrien <camaradetux@gmail.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h)
Date: Sun, 1 Nov 2009 13:12:33 +0100 [thread overview]
Message-ID: <666572260911010412n3f60bb21pc6e1d3bb70279f58@mail.gmail.com> (raw)
In-Reply-To: <87ljiqmrjy.fsf@mid.deneb.enyo.de>
On 01/11/2009, Florian Weimer <fw@deneb.enyo.de> wrote:
> * Adrien:
>
>> It turned out it worked on linux x86_32, linux x86_64, netbsd sparc64
>> with 32-bit userland, debian's kfreebsd amd64 and ppc32. There's
>> windows which I haven't checked yet though.
>
> x86_64 has different calling conventions for varargs and non-varargs
> functions. If it works for you, it's only by accident (e.g. because
> you aren't passing floating-point arguments).
>
I tried a few things with "double" at first since I'm on x86_64 and
got no warning and no problem whatsoever. The situation was a bit
different with "float" however :
> a.c:16: warning: ‘float’ is promoted to ‘double’ when passed through ‘...’
> a.c:16: note: (so you should pass ‘double’ not ‘float’ to ‘va_arg’)
> a.c:16: note: if this code is reached, the program will abort
Running the program yields a nice: "illegal hardware instruction ./a.out". :)
The problem is the same on x86_32 however, and APIs are probably
correct with regard to that. I'll see if I can add checks in ocaml-gir
nonetheless. Thanks.
---
Adrien Nader
next prev parent reply other threads:[~2009-11-01 12:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-28 22:07 Adrien
2009-10-28 22:45 ` Basile STARYNKEVITCH
2009-10-29 8:55 ` Goswin von Brederlow
2009-10-29 21:37 ` Adrien
2009-10-29 23:31 ` Goswin von Brederlow
2009-10-29 21:18 ` Adrien
2009-10-30 9:35 ` Xavier Leroy
2009-11-01 9:31 ` Adrien
2009-11-01 11:07 ` Florian Weimer
2009-11-01 12:12 ` Adrien [this message]
2009-11-01 12:16 ` Florian Weimer
2009-11-01 14:58 ` Adrien
2009-11-01 20:06 ` Richard Jones
2009-11-03 19:33 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=666572260911010412n3f60bb21pc6e1d3bb70279f58@mail.gmail.com \
--to=camaradetux@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=fw@deneb.enyo.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).