From cccfe33f7f80825fb72d8f63c106a7d7edfbd3cb Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 18 May 2016 22:36:59 +0900 Subject: [PATCH] patch from kipples for ffi struct args (fixes issue #330) --- tests/ffi/ffi-tests.scm | 3 +-- tools/chibi-ffi | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/ffi/ffi-tests.scm b/tests/ffi/ffi-tests.scm index 846be137..bd48d936 100644 --- a/tests/ffi/ffi-tests.scm +++ b/tests/ffi/ffi-tests.scm @@ -284,8 +284,7 @@ double circle_area2(struct Circle circ) { ((struct Point) center circle-center) (double radius circle-radius)) (define-c double circle_area1 (Circle)) - ;; TODO: struct means no pointer - ;;(define-c double circle_area2 ((struct Circle))) + (define-c double circle_area2 ((struct Circle))) (define-c-type Color predicate: color?) (define-c void set_color (short short short (result pointer Color))) (define-c Color make_color (short short short)) diff --git a/tools/chibi-ffi b/tools/chibi-ffi index a1b6c073..5e3120b7 100755 --- a/tools/chibi-ffi +++ b/tools/chibi-ffi @@ -764,7 +764,7 @@ (void*? (void-pointer-type? type))) (cond ((or ctype void*?) - (cat (if (type-reference? type) "*" "") + (cat (if (or (type-struct? type) (type-reference? type)) "*" "") "(" (type-c-name type) ")" (if (type-null? type) "sexp_cpointer_maybe_null_value"