From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id DA8AABBAF for ; Sun, 1 Nov 2009 15:58:48 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUBAIsw7UrRVdrVkGdsb2JhbACRaYIshn4/AQEBAQkJDAcTA61qgTmFAohoAQMDBYQ0BIFi X-IronPort-AV: E=Sophos;i="4.44,662,1249250400"; d="scan'208";a="49597018" Received: from mail-bw0-f213.google.com ([209.85.218.213]) by mail4-smtp-sop.national.inria.fr with ESMTP; 01 Nov 2009 15:58:48 +0100 Received: by bwz5 with SMTP id 5so5449254bwz.3 for ; Sun, 01 Nov 2009 06:58:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=YnMrLxC9WSikYrFm65BV+CrJGIxQ0UwyRVfdFxwOOTc=; b=ObaJ5u+CrqpU7WBSjbq++stfYc6eMQwO/XqxK5h9nB0UckF/e8waDhSrIcCZXys0yz mi7VH2KVd4BaRQSCFU1wLEGp9L/smeOxbIThFGs2cuaNcF4bK/rX+kVr79hwqLAeidb/ msH+E3o2FLX4dP/19jGCT8wJqYil2QQLfJvDw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=jZcgDkobBnco50gSpVMVI/hqISKanLO5pXYLUfoE9uehKkuL8/Z2Q37T2FvdLKDuE9 Pu3xzujaX6jwKKXnL+okO6+/dumJF/YhVwKp0vNL/UN2JPLp7CTyLKFoNQ9+LalXpUWZ EcgcxwpFg/vQgIl3YEIt/nb/HZ8vbJw6Z7LbQ= MIME-Version: 1.0 Received: by 10.103.127.32 with SMTP id e32mr1610467mun.70.1257087527909; Sun, 01 Nov 2009 06:58:47 -0800 (PST) In-Reply-To: <87r5sil9sz.fsf@mid.deneb.enyo.de> References: <666572260910281507q74cb1c1at157c9e3c86070c69@mail.gmail.com> <4AE8C987.8020100@starynkevitch.net> <666572260910291418p585b0aa9laadc14f6589c9772@mail.gmail.com> <4AEAB347.3060008@inria.fr> <666572260911010131x1b3c778bgc1c87879ca96a62d@mail.gmail.com> <87ljiqmrjy.fsf@mid.deneb.enyo.de> <666572260911010412n3f60bb21pc6e1d3bb70279f58@mail.gmail.com> <87r5sil9sz.fsf@mid.deneb.enyo.de> Date: Sun, 1 Nov 2009 15:58:47 +0100 Message-ID: <666572260911010658r2eb8bdfbl9b06222079869c7b@mail.gmail.com> Subject: Re: [Caml-list] Binding C libraries which use variable arguments (stdarg.h) From: Adrien To: Florian Weimer Cc: Caml Mailing List Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; userland:01 debian's:01 varargs:01 rax:01 wrote:01 wrote:01 caml-list:01 functions:01 conventions:02 asm:02 binding:02 florian:03 florian:03 passing:05 problem:05 On 01/11/2009, Florian Weimer wrote: > * Adrien: > >> On 01/11/2009, Florian Weimer 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. > > Could you check if libffi sets the %rax register to the number of > floating-point arguments? (I've seen this working by mere chance in > many cases.) > Unfortunately I don't know much about asm, I tried to check but failed (couldn't find what "leaq" meant). I found a few references indicating that libffi was properly doing that however. --- Adrien Nader