summaryrefslogtreecommitdiffstats
path: root/ffi.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-04-29 10:12:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-04-29 10:12:04 -0700
commita77610707ca983a74e4f0af8926d663fdb71ecbf (patch)
treec1e29e6ac9bd7f1b99dfde14c6a871810c314466 /ffi.h
parent6828981bba93db9fa7267f68516a6b3a0ecc157e (diff)
downloadtxr-a77610707ca983a74e4f0af8926d663fdb71ecbf.tar.gz
txr-a77610707ca983a74e4f0af8926d663fdb71ecbf.tar.bz2
txr-a77610707ca983a74e4f0af8926d663fdb71ecbf.zip
ffi: add ptr-in-d and ptr-out-d.
ptr-in-d means we pass a buffer to the foreign function, which it owns and must free. We don't touch it. ptr-out-d is meaningful for returned values. It means that the function returned the object in a malloced buffer which the caller owns. It will be freed. * ffi.c (ptr_in_d_s, ptr_out_d_s): New symbol variables. (ffi_ptr_in_d_put, ffi_ptr_out_d_get): New static functions. (make_ffi_type_pointer): Don't set rtsize unconditionally to 1. If we are passed a null pointer for the in function, set it to zero. ptr-in-d does this: it has no need to free the buffer since the called function owns it and so there is no in function for that type. (ffi_type_compile): Handle ptr_in_d_s and ptr_out_d_s. (ffi_init): Initialize ptr_in_d_s and ptr_out_d_s. * ffi.h (ptr_in_d_s, ptr_out_d_s): Declared.
Diffstat (limited to 'ffi.h')
-rw-r--r--ffi.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ffi.h b/ffi.h
index 27e9bc10..1aca9f19 100644
--- a/ffi.h
+++ b/ffi.h
@@ -41,7 +41,7 @@ extern val str_d_s, wstr_s, wstr_d_s;
extern val buf_d_s;
-extern val ptr_in_s, ptr_out_s, ptr_s;
+extern val ptr_in_s, ptr_out_s, ptr_in_d_s, ptr_out_d_s, ptr_s;
extern val array_s;