From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7644 invoked by alias); 28 Oct 2014 18:32:14 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 7624 invoked by uid 89); 28 Oct 2014 18:32:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qg0-f46.google.com Received: from mail-qg0-f46.google.com (HELO mail-qg0-f46.google.com) (209.85.192.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 28 Oct 2014 18:32:11 +0000 Received: by mail-qg0-f46.google.com with SMTP id i50so59096qgf.19 for ; Tue, 28 Oct 2014 11:32:08 -0700 (PDT) X-Received: by 10.140.30.98 with SMTP id c89mr7307627qgc.90.1414521128688; Tue, 28 Oct 2014 11:32:08 -0700 (PDT) Received: from anchor.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id j1sm1948207qao.38.2014.10.28.11.32.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Oct 2014 11:32:08 -0700 (PDT) From: Richard Henderson To: libffi-discuss@sourceware.org Subject: [PATCH 1/8] Add entry points for interacting with Go Date: Tue, 28 Oct 2014 18:32:00 -0000 Message-Id: <1414521094-18403-2-git-send-email-rth@twiddle.net> In-Reply-To: <1414521094-18403-1-git-send-email-rth@twiddle.net> References: <1414521094-18403-1-git-send-email-rth@twiddle.net> X-SW-Source: 2014/txt/msg00129.txt.bz2 A "ffi_go_closure" is intended to be compatible with the function descriptors used by Go, and ffi_call_go sets up the static chain parameter for calling a Go function. The entry points are disabled when a backend has not been updated, much like we do for "normal" closures. --- include/ffi.h.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/ffi.h.in b/include/ffi.h.in index f403ae0..c43d52f 100644 --- a/include/ffi.h.in +++ b/include/ffi.h.in @@ -428,6 +428,22 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, #endif /* FFI_CLOSURES */ +#if FFI_GO_CLOSURES + +typedef struct { + void *tramp; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); +} ffi_go_closure; + +ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*)); + +void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, + void **avalue, void *closure); + +#endif /* FFI_GO_CLOSURES */ + /* ---- Public interface definition -------------------------------------- */ ffi_status ffi_prep_cif(ffi_cif *cif, -- 1.9.3