Skip to content

Commit

Permalink
Add entry points for interacting with Go
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rth7680 committed Nov 12, 2014
1 parent a0bdc52 commit e951d64
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/ffi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e951d64

Please sign in to comment.