diff options
-rw-r--r-- | ffi.c | 14 | ||||
-rw-r--r-- | tests/017/ffi-misc.tl | 4 |
2 files changed, 10 insertions, 8 deletions
@@ -3820,15 +3820,10 @@ val ffi_type_compile(val syntax) if (length(syntax) == two) { val eltype_syntax = cadr(syntax); val eltype = ffi_type_compile(eltype_syntax); - val type = make_ffi_type_pointer(syntax, vec_s, - ffi_varray_put, ffi_void_get, - ffi_varray_in, 0, ffi_varray_release, - eltype); + val type = make_ffi_type_array(syntax, vec_s, zero, eltype, self); struct txr_ffi_type *tft = ffi_type_struct(type); struct txr_ffi_type *etft = ffi_type_struct(eltype); - tft->kind = FFI_KIND_ARRAY; - if (etft->incomplete || etft->bitfield) uw_throwf(error_s, lit("~a: ~a ~s cannot be array element"), @@ -3836,6 +3831,13 @@ val ffi_type_compile(val syntax) if3(etft->bitfield, lit("bitfield"), lit("incomplete type")), eltype_syntax, nao); + + tft->put = ffi_varray_put; + tft->get = ffi_void_get; + tft->in = ffi_varray_in; + tft->out = 0; + tft->release = ffi_varray_release; + if (sym == zarray_s) { tft->null_term = 1; tft->get = ffi_varray_null_term_get; diff --git a/tests/017/ffi-misc.tl b/tests/017/ffi-misc.tl index 6e41f482..1b729bbc 100644 --- a/tests/017/ffi-misc.tl +++ b/tests/017/ffi-misc.tl @@ -92,5 +92,5 @@ (ffi (struct flex (x char) (y (zarray char)))) (mtest - (ffi-put (new flex x #\a y "bcd") (ffi (struct flex))) #b'6100000062636400' - (ffi-get #b'6100000062636400' (ffi (struct flex))) #S(flex x #\a y "bcd")) + (ffi-put (new flex x #\a y "bcd") (ffi (struct flex))) #b'6162636400' + (ffi-get #b'6162636400' (ffi (struct flex))) #S(flex x #\a y "bcd")) |