Changeset 18804 in project


Ignore:
Timestamp:
07/12/10 21:08:51 (10 years ago)
Author:
svnwiki
Message:

Changes applied for Alexandre Boily (132.203.171.205) through svnwiki:

Updated example for Easyffi 1.99.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/An extended FFI example

    r2792 r18804  
    1212 ;;;; gtkhello.scm
    1313
     14 (require-extension easyffi)
     15
    1416 ;; Include this code directly into generated .c file:
    1517
    16  #>
    17  #include <gtk/gtk.h>
    18  <#
     18 (foreign-declare "#include <gtk/gtk.h>")
    1919
    2020 ;; Parse declarations and generate Scheme bindings:
    2121
    22  #>?
    23  /* We just need a declaration, so this is sufficient: */
     22 (foreign-parse "
    2423 const int GTK_WINDOW_TOPLEVEL;
    2524
     
    3534 void gtk_widget_show(GtkWidget *);
    3635
    37  /* the ___callback marker is needed, because gtk_main() may
     36 /* the ___safe marker is needed, because gtk_main() may
    3837   (and will) call Scheme callbacks. */
    39  ___callback void gtk_main();
    40  <#
     38 ___safe void gtk_main();
     39 ")
    4140
    4241
     
    5251                                (c-pointer data) )
    5352   bool
    54    (print delete event occurred)
     53   (print "Delete event occured")
    5554   #t)
    5655
     
    6867 (define window (gtk_window_new GTK_WINDOW_TOPLEVEL))
    6968
    70  ;; $#... with a callback-name returns the function pointer:
     69 ;; #$... with a callback-name returns the function pointer:
    7170
    7271 (g_signal_connect window "delete_event" #$delete_event #f)
Note: See TracChangeset for help on using the changeset viewer.