From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 7FB663857C50 for ; Fri, 19 Mar 2021 11:43:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7FB663857C50 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-339-qWphACg6OcmxXf1CoagJxA-1; Fri, 19 Mar 2021 07:43:05 -0400 X-MC-Unique: qWphACg6OcmxXf1CoagJxA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B630107B768; Fri, 19 Mar 2021 11:43:04 +0000 (UTC) Received: from zarquon.pink (unknown [10.33.36.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3DA1189A5; Fri, 19 Mar 2021 11:43:03 +0000 (UTC) Subject: Re: How to call 'printf' using libffi? To: Anthony Green Cc: libffi-discuss References: <00aed94e-6f76-f6d7-9878-a3eb50dce543@163.com> <7c8729d8-d10e-cdb8-5518-e2f82ccbe141@redhat.com> From: Andrew Haley Message-ID: <71f0c5ea-e3b7-176e-a0a1-29dceeff69b9@redhat.com> Date: Fri, 19 Mar 2021 11:43:02 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libffi-discuss@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libffi-discuss mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 11:43:10 -0000 On 3/19/21 11:01 AM, Anthony Green wrote: >>> ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 3, &ffi_type_sint, >> arg_types); >> >> Surely that only works if a varargs call uses the same ABI as a normal >> call. They don't always, >> > I'm using the '_var' variant of ffi_prep_cif that takes this into account. Aha! Missed it. -- Andrew Haley (he/him) Java Platform Lead Engineer Red Hat UK Ltd. https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671