|From:||Nicholas \"Indy\" Ray|
|Subject:||Re: [Chicken-users] Ref foreign type.|
|Date:||Tue, 22 Sep 2009 03:06:00 -0700|
Looks like there are two issues here. First, try applying the
attached patch to fix a bug in c-backend. Second, your usage is
incorrect--ref types require an operating system pointer or a locative
(since they can be modified)--ref is the analog of c-pointer. For
example, you can change your example to:
(let-location ((c char #\c))
((foreign-lambda* bool (((ref char) mC))(location c))))
"C_return(mC == 'c');")
Of course, you must then compile with csc -c++.
2009/9/21 Nicholas "Indy" Ray <address@hidden>:
> _______________________________________________> I've been trying to use the "ref" FFI type (as documented here:
> http://chicken.wiki.br/man/4/Foreign%20type%20specifiers#(ref TYPE) ) with
> no success. Here is an example of my usage:
> ((foreign-lambda* bool (((ref char) mC))
> "C_return(mC == 'c');")
> compiling this with csc from Chicken 4 gives me the error:
> Error: illegal foreign type `ref'
> I find this odd as in c-backend.scm:1170 in foreign-type-declaration this
> code exists:
> ((and (= 2 len)
> (eq? 'ref (car type)))
> (foreign-type-declaration (cadr type) (string-append "&" target)) )
> Implying that ref should still be supported.
> Any help with this would be greatly appreciated.
> Chicken-users mailing list
|[Prev in Thread]||Current Thread||[Next in Thread]|