From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14569 invoked by alias); 13 Nov 2007 21:33:35 -0000 Received: (qmail 14444 invoked by uid 22791); 13 Nov 2007 21:33:34 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 13 Nov 2007 21:33:30 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id lADLXQoW022385; Tue, 13 Nov 2007 16:33:26 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lADLXPH9029691; Tue, 13 Nov 2007 16:33:25 -0500 Received: from opsy.redhat.com (ton.yyz.redhat.com [10.15.16.15]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lADLXOeN032059; Tue, 13 Nov 2007 16:33:25 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id CF713378B0E; Tue, 13 Nov 2007 14:08:21 -0700 (MST) To: Timothy Wall Cc: gcc-patches@gcc.gnu.org Subject: Re: libffi stdcall closures References: <8269E7B3-A99E-42AC-9314-2613A1C26ABF@users.sf.net> <6F9E5081-D1B5-4D4C-9FC1-D90D22709C9D@dev.java.net> From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom Date: Tue, 13 Nov 2007 23:28:00 -0000 In-Reply-To: <6F9E5081-D1B5-4D4C-9FC1-D90D22709C9D@dev.java.net> (Timothy Wall's message of "Thu\, 08 Nov 2007 18\:24\:44 -0500") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg00754.txt.bz2 >>>>> "Timothy" == Timothy Wall writes: Timothy> Here's the patch for stdcall closures, including a basic test. The Timothy> diff is against the JNA repo; I can probably do one against a gcc Timothy> checkout if necessary. I'm not really an x86 expert, so perhaps a port maintainer could look it over. The test case also looked good at first blush, but Andreas is really the person for that... I have a couple nits to pick, but nothing major. Timothy> BTW, the lack of support came up as people were trying to install Timothy> Java callbacks into various windows API functions (services, keyboard Timothy> hooks, etc). Some would work fine, others would crash. I wasn't Timothy> aware that libffi didn't have stdcall closure support since the few Timothy> simple tests and examples I wrote just happened to work. FWIW there are other areas where you may run into problems. The biggest one is varargs -- libffi basically doesn't support this at all. I'm sure there are more obscure ones, too, involving any new ABI additions... maybe vectors, or decimal float, or I don't know what. Timothy> +#ifdef X86_WIN32 Timothy> + if (cif->abi == FFI_STDCALL) { Timothy> + FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], \ Timothy> + &ffi_closure_STDCALL, \ Timothy> + (void*)closure, cif->bytes); Timothy> + } Timothy> +#endif You don't need the backslashes here. I see them elsewhere in the file, but they are bogus. Also the "{" should be on its own line. Also, it looks to me as though there's a missing 'else' in here... shouldn't we call either FFI_INIT_TRAMPOLINE_STDCALL or FFI_INIT_TRAMPOLINE, but not both? thanks, Tom