This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
[PATCH 1/8] Add entry points for interacting with Go
- From: Richard Henderson <rth at twiddle dot net>
- To: libffi-discuss at sourceware dot org
- Date: Tue, 28 Oct 2014 11:31:27 -0700
- Subject: [PATCH 1/8] Add entry points for interacting with Go
- Authentication-results: sourceware.org; auth=none
- References: <1414521094-18403-1-git-send-email-rth at twiddle dot net>
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