Good job! 2017年6月28日 上午10:26,"Matt Wette" 写道: > Hi All, > > I am working on a ffi-helper: a program that will read in a C dot-h file > and generate a Guile dot-scm file which defines a module to provide hooks > into the associated C library. A little status on type handling: > > For nominal C types I am trying to stick to the (system foreign) type > system. For aggregate types I am using scheme-bytestructures ( > https://github.com/TaylanUB/scheme-bytestructures). However, I am > currently putting a guile struct wrapper on top of bytestructure > descriptors in order to provide a more user-friendly interface (IMO). > > In the demo I have created a (cairo cairo-svg) ffi-module which gets > converted to a guile module via > $ guild compile-ffi cairo/cairo-svg.ffi > > Then I start guile and do this: > > scheme@(guile-user)> (use-modules (cairo cairo-svg)) > scheme@(guile-user)> (use-modules (ffi-help)) > scheme@(guile-user)> (use-modules (system foreign)) > > scheme@(guile-user)> (define srf (cairo_svg_surface_create > (string->pointer "abc.svg") 200.0 200.0)) > scheme@(guile-user)> srf > $2 = > > @(guile-user)> (define cr (cairo_create srf)) > scheme@(guile-user)> cr > $1 = > > scheme@(guile-user)> (define mx (make-cairo_matrix_t)) > scheme@(guile-user)> mx > $3 = # > > scheme@(guile-user)> (pointer-to mx) > $4 = > > scheme@(guile-user)> (cairo_get_font_matrix cr (pointer-to mx)) > scheme@(guile-user)> > > Matt > > >