I am working on a ffi-helper (FH): 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. 

I have support for functions which use varargs working.  Users must cast 
undeclared
arguments:

mwette$ cat tryme.h
int printf(char *fmt, ...);

mwette$ cat tryme.ffi
(define-ffi-module (tryme)
  #:include '("tryme.h")
  #:library '("libz")) ;; need dummy

mwette$ guild compile-ffi tryme.ffi
wrote `tryme.scm'

mwette$ guild compile tryme.scm
wrote `/..../tryme.scm.go'

mwette$ guile
scheme@(guile-user)> (use-modules (tryme))
scheme@(guile-user)> (use-modules (system ffi-help-rt))
scheme@(guile-user)> (use-modules (system foreign))

scheme@(guile-user)> (printf "Hello, for the %d-th time\n" (fh-cast int 10))
Hello, for the 10-th time
$1 = 26

scheme@(guile-user)> 


Reply via email to