no title added by matijja on Mon Feb 4 19:36:30 2019

#>
void* ptr;
<#

(define init-root
  (foreign-lambda* void ((scheme-object obj)) "
    ptr = CHICKEN_new_gc_root();
    CHICKEN_gc_root_set(ptr, obj);"))

(define root-ref
  (foreign-lambda* scheme-object () "
    C_return(CHICKEN_gc_root_ref(ptr));"))

(init-root (foreign-safe-lambda void on_quit c-pointer c-pointer))

(let ((window (gtk_window_new GTK_WINDOW_TOPLEVEL)))
  (gtk_widget_show window)
  (display (root-ref))
  (newline)
  (g_signal_connect_data window "destroy" (root-ref) #f #f 0)
  ((foreign-safe-lambda void gtk_main)))