> On Sep 10, 2017, at 8:37 AM, Matt Wette <matt.we...@gmail.com> wrote: > > Nyacc 0.82.0 has been released > > In this version I have cleaned up more of the FFI Helper. Note: > 1) In the distribution, you will see example .ffi files in examples/ffi/. > 2) use of the FFI Helper required the bytestructures package, available from: > https://github.com/TaylanUB/scheme-bytestructures > 3) ffi/cairo.ffi is converted to ffi/cairo.scm by the command > $ guild compile-ffi ffi/cairo.ffi > 4) It works on my mac. I don't know what else: the code needs to have access > to files in odd places (e.g., lib/gcc/..../include > 5) If you do `make install', and have bytestructures in the SITE_SCM_DIR, > then > this should work: > $ make install-ffi-help > ... > +++ warning: the FFI Helper is experimental > ffi-help: can't do varargs (yet) > wrote `/var/tmp/zz/scm/ffi/sqlite3.scm' > wrote `/var/tmp/zz/go/ffi/sqlite3.go' > +++ warning: the FFI Helper is experimental > ffi-help: can't do varargs (yet) > wrote `/var/tmp/zz/scm/ffi/libgit2.scm' > wrote `/var/tmp/zz/go/ffi/libgit2.go' > +++ warning: the FFI Helper is experimental > ffi-help: can't do varargs (yet) > ffi-help: no FFI float-type for "long double" > wrote `/var/tmp/zz/scm/ffi/glib.scm' > wrote `/var/tmp/zz/go/ffi/glib.go'
Some additional notes: 6) compile-ffi and compile may take significant time. I have seen compile-ffi take time on include files that have a large number of re-includes. Nyacc does not try to skip re-reading include files (like gcc does). And compile takes a long time because the .scm files can be huge. On my machine, ffi/gio.scm turns out to be about 24 K lines and the gio.go file is 8 MB. 7) In examples I show that passing strings to function is done via (foo (string->pointer "abc")). Using string->pointer is not required: unwrap~pointer will now deal with this. 8) the FFI Helper files .scm files are distributed in SCM_DIR -- not under nyacc/ : + scripts/compile-ffi.scm is the compiler driver invoked by `guild' + system/ffi-help-rt.scm is the FFI Helper runtime (macros for defining types, etc) + ffi/ is the conventional place to host .ffi files, so ffi/glib.scm is code for (ffi glib) 9) I will need to look into how to add some needed types in guile FFI: intptr_t, long long, long double. Matt