chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] (new) gtk+ egg using swig


From: Alejandro Forero Cuervo
Subject: [Chicken-users] (new) gtk+ egg using swig
Date: Tue, 30 Aug 2005 21:55:34 -0500
User-agent: Mutt/1.5.9i

Manuel Alejandro Cerón Estrada and I have started a gtk+ and a glib
2.0 eggs to make these libraries callable from Chicken.  We decided to
use the Chicken swig module to create them (instead of manually
defining all the bindings).

These eggs are still very incomplete since our swig interface file
only includes a few of gtk+'s header files.  However, we expect to
continue to include header files until the entire gtk+ API is
available from Scheme.

There is more information about these eggs at:

  http://cgi.afc.no-ip.info/svnwiki.cgi/default/chicken-gtk

It seems to work but we still need to resolve some issues.

We are currently doing this in our interface file:

  %{
  static void
  EGG_signal_handle ( gpointer *obj, gpointer closure_root )
  {
    C_callback(CHICKEN_gc_root_ref(closure_root), 0);
  }
  %}

  %inline %{
  gulong
  EGG_g_signal_connect (gpointer obj, const gchar *type, C_word closure)
  {
    void *closure_root = CHICKEN_new_gc_root();
    CHICKEN_gc_root_set(closure_root, closure);
    return g_signal_connect(G_OBJECT(obj), type, G_CALLBACK(EGG_signal_handle), 
closure_root);
  }
  %}

Ignore, for the moment, the memory leak there.  When the Scheme
programmer calls “(gtk-main)”, a wrapper for gtk+'s “gtk_main”, we can
expect “EGG_signal_handle” to get called.  Is it safe to use
“C_callback” there?  If not, is there a way to tag “gtk_main” such
that calls to (gtk-main) will call it safely (just like
foreign-callback-lambda does)?

I would appreciate it if someone with more experience with swig could
look at our interface files to see if we're doing something wrong.
We had never worked with swig before.

Thanks!

Alejo.
http://azul.freaks-unidos.net/

---=(  Comunidad de Usuarios de Software Libre en Colombia  )=---
---=(  http://bachue.com/colibri )=--=( address@hidden  )=---

Attachment: signature.asc
Description: Digital signature


reply via email to

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