diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-16 06:20:38 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-16 06:20:38 -0700 |
commit | 05139e8962cfd721b548bb7e98de715fa7da7391 (patch) | |
tree | 3ea12d04ef3d4c1ba688af833e9e04482b56c02e | |
parent | b36539d05950effb644242ef2596e410de62f004 (diff) | |
download | txr-05139e8962cfd721b548bb7e98de715fa7da7391.tar.gz txr-05139e8962cfd721b548bb7e98de715fa7da7391.tar.bz2 txr-05139e8962cfd721b548bb7e98de715fa7da7391.zip |
ffi: tagged cptr type, for improved safety.
-rw-r--r-- | ffi.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1588,6 +1588,14 @@ val ffi_type_compile(val syntax) tft->in = if3(sym == buf_s, ffi_buf_in, ffi_buf_d_in); tft->nelem = nelem; return type; + } else if (sym == cptr_s) { + val tag = cadr(syntax); + val type = make_ffi_type_builtin(syntax, cptr_s, sizeof (mem_t *), + &ffi_type_pointer, + ffi_cptr_put, ffi_cptr_get); + struct txr_ffi_type *tft = ffi_type_struct(type); + tft->mtypes = tag; + return type; } uw_throwf(error_s, lit("~a: unrecognized type operator: ~s"), |