Leonardo Lopes Pereira:

I would like to know if is there any way to convert C structs to any type of 
Guile data.


SND has some neat features for doing that:
http://ccrma.stanford.edu/software/snd/

Example:

(load-from-path "eval-c.scm")
#<unspecified>

(define-ec-struct <test>
  <int> data
  <int-*> datas
  <something-else-*> somethingelse)
#<unspecified>

(define test (<test> #:data 1
                     #:datas '(2 3 4)))
#<unspecified>

(-> test data)
1

(-> test data 5)
#<unspecified>

(-> test data)
5

(-> test datas)
(2 3 4)

(-> test datas '(9 2 3 4))
#<unspecified>

(-> test datas)
(9 2 3 4)

I think there are direct support for chars, floats, ints, floats, doubles, strings and SCMs. Everything else is treated as pointers.



--


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to