From abc64add6a46971c3ccf422b1daae01f82f98d25 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 16 May 2017 06:20:38 -0700 Subject: ffi: tagged cptr type, for improved safety. --- ffi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ffi.c b/ffi.c index be08e597..c588c659 100644 --- a/ffi.c +++ b/ffi.c @@ -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"), -- cgit v1.2.3