shhyou / ypsilon-fork

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

Various types not supported by the FFI #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not really issues, just a request: bool isn't supported at all and would be 
quite useful, and char* isn't supported as a return value. Both of these 
would be extremely helpful.

Original issue reported on code.google.com by mass...@gmail.com on 4 Sep 2008 at 4:16

GoogleCodeExporter commented 9 years ago
Thank you for your message.
Yes, I will add them. :)

Original comment by y.fujita...@gmail.com on 5 Sep 2008 at 10:45

GoogleCodeExporter commented 9 years ago
I have added `char*` and `bool` in revision 198.
svn trunk directory is updated. Please try. Thank you!

----

(import (ffi))

;; this example uses linux standard C library
(define libStdC (load-shared-object "libc.so.6"))

;; C prototype: char* strstr(const char *s1, const char *s2);
(define strstr (c-function libStdC "Standard C Library" char* strstr (char* 
char*)))

(strstr "hello world" "wo") ;=> "world"

(strstr "θλσ" "λ") ;=> "λσ"

(strstr "foo" "bar") ;=> #f

Original comment by y.fujita...@gmail.com on 7 Sep 2008 at 1:46