You are looking at historical revision 1620 of this page. It may differ significantly from its current revision.

Here is an example for a simple program that uses CHICKEN's foreign function interface. It is the Gtk 2.0 Hello, world program as presented in the GTK tutorial, which is available here.

This example is intended to show various features of the FFI and to demonstrate that one can go relatively far without writing tons of glue code. The comments are only to show the CHICKEN specific things, see the original tutorial for more information.

;;;; gtkhello.scm

;; Include this code directly into generated .c file:

#>
#include <gtk/gtk.h>
<#

;; Parse declarations and generate Scheme bindings:

#>?
/* We just need a declaration, so this is sufficient: */
const int GTK_WINDOW_TOPLEVEL;