guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ffi-help: varargs ...


From: Matt Wette
Subject: ffi-help: varargs ...
Date: Thu, 16 Nov 2017 06:00:35 -0800

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

[Prev in Thread] Current Thread [Next in Thread]