unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* ffi-help: varargs ...
@ 2017-11-16 14:00 Matt Wette
  2017-12-07  2:46 ` ffi-help: documentation Matt Wette
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Wette @ 2017-11-16 14:00 UTC (permalink / raw)
  To: Guile User Mailing List

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)> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-07 21:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 14:00 ffi-help: varargs Matt Wette
2017-12-07  2:46 ` ffi-help: documentation Matt Wette
2018-01-07 21:19   ` Thien-Thi Nguyen
2018-01-07 21:21     ` Matt Wette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).