mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-25 13:05:05 +02:00
New example
This commit is contained in:
parent
db7a82899b
commit
e06cd94354
1 changed files with 14 additions and 0 deletions
14
examples/ffi/custom-type.scm
Normal file
14
examples/ffi/custom-type.scm
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
;;
|
||||||
|
;; Basic example of using a custom type
|
||||||
|
;;
|
||||||
|
(import (scheme base)
|
||||||
|
(scheme write)
|
||||||
|
(cyclone foreign))
|
||||||
|
|
||||||
|
(c-define-type string-as-integer string number->string string->number)
|
||||||
|
(c-define scm-strlen int "strlen" string-as-integer)
|
||||||
|
|
||||||
|
(write
|
||||||
|
(scm-strlen 42)
|
||||||
|
)
|
||||||
|
(newline)
|
Loading…
Add table
Reference in a new issue