diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-04-30 09:03:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-04-30 09:03:52 -0700 |
commit | 899a209f71111857b39a2eacb46bcb2484130133 (patch) | |
tree | 4ec456f00c96775e7873cf85979e6ca8fb572225 /ffi.h | |
parent | 310bc8183d5b3d794618ace3122f3aa2f16dc47a (diff) | |
download | txr-899a209f71111857b39a2eacb46bcb2484130133.tar.gz txr-899a209f71111857b39a2eacb46bcb2484130133.tar.bz2 txr-899a209f71111857b39a2eacb46bcb2484130133.zip |
ffi: implementing FFI callback closures.
* ffi.c (closure_s, ffi_closure_s): New symbol vars.
(struct txr_ffi_closure): New type.
(ffi_closure_struct, ffi_closure_struct_checked,
ffi_closure_print_op, ffi_closure_destroy_op,
ffi_closure_mark_op): New static functions.
(ffi_closure_ops): New static struct.
(ffi_closure_put): New static function.
(ffi_type_compile): Handle closure_s to support closure type
specifier.
(ffi_closure_dispatch): New static function.
(ffi_make_closure, ffi_closure_get_fptr): New function.
(ffi_init): Initialize closure_ and ffi_closure_s.
Register ffi-make-closure intrinsic.
* ffi.c (closure_s, ffi_closure_s, ffi_make_closure,
ffi_closure_get_fptr): Likewise.
Diffstat (limited to 'ffi.h')
-rw-r--r-- | ffi.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -47,9 +47,13 @@ extern val buf_d_s; extern val ptr_in_s, ptr_out_s, ptr_in_d_s, ptr_out_d_s, ptr_s; -extern val ffi_type_s, ffi_call_desc_s; +extern val closure_s; + +extern val ffi_type_s, ffi_call_desc_s, ffi_closure_s; val ffi_type_compile(val syntax); val ffi_make_call_desc(val ntotal, val nfixed, val rettype, val argtypes); +val ffi_make_closure(val fun, val call_desc); +mem_t *ffi_closure_get_fptr(val closure); val ffi_call_wrap(val ffi_call_desc, val fptr, val args); void ffi_init(void); |