ffi-complex/main.scm

(define-module (main)
  #:use-module (system foreign)
  #:export (make-body make-page create-page))

(define lib (dynamic-link "main"))

(define (make-body format text)
  (make-c-struct '(* *) (list (string->pointer format)
			      (string->pointer text))))

(define (make-page title body)
  (make-c-struct '(* *) (list (string->pointer title) body)))

(define create-page
  (let ((create (pointer->procedure
		 void
		 (dynamic-func "CCreate" lib)
		 '(*))))
    (lambda (page)
      (create page))))