This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
[PATCH 06/13] libffi: Add entry points for interacting with Go
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: libffi-discuss at sourceware dot org, gofrontend-dev at googlegroups dot com
- Date: Fri, 10 Oct 2014 13:42:46 -0700
- Subject: [PATCH 06/13] libffi: Add entry points for interacting with Go
- Authentication-results: sourceware.org; auth=none
- References: <1412973773-3942-1-git-send-email-rth at redhat dot com>
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.
---
libffi/include/ffi.h.in | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/libffi/include/ffi.h.in b/libffi/include/ffi.h.in
index 380673b..ccd4ac0 100644
--- a/libffi/include/ffi.h.in
+++ b/libffi/include/ffi.h.in
@@ -390,6 +390,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