Re: Creating GObject/GTK bindings for language



I apologize for being so terse. I was grasping at straws, trying to think
of a specific question regarding GTK binding to get me started. There
have been plenty of bindings to scripting languages in the past, so
I thought asking about them in general would be the quickest way to
get information about making binding.

I would like bindings for GTK from Objective C. I originally started
to bind classes manually, starting with GList in GLib. While I know
that this will take time, if I use that method, I'll die before
I finish.

I've looked at the obgtk and GTKKit bindings for GTK1, and some of it
does look helpful (like how to associate ObjC methods with signals),
but GTK has grown so much since then. I'm not sure if it's reasonable
to build off of that.

How much of this process is not automated? 

I would like to know how to minimize some of the work involved. Looking at
the gir xml stored in the GLib.typelib reveals xml descriptions of
what looks like all of the library's classes, but doing the same thing
for the libxml typelib shows a gir file that doesn't look complete. How
do I know I can trust the .gir file to have a complete description of
the library it purports to describe.

Secondly, is it header information that is usually automatically generated?
Do maintainers then go and manually write the implementations themselves?


Finally, do you have a suggestion as to where I can start? Am I on the
right track in first trying to get automatically generated headers from
the typelib information?



--- On Fri, 2/26/10, John Palmieri <johnp redhat com> wrote:

> From: John Palmieri <johnp redhat com>
> Subject: Re: Creating GObject/GTK bindings for language
> To: "Tristin Celestin" <tristin_celestin yahoo com>
> Cc: gtk-devel-list gnome org
> Date: Friday, February 26, 2010, 12:14 PM
> 
> ----- "Tristin Celestin" <tristin_celestin yahoo com>
> wrote:
> 
> > I want to be able to use GObject and GObject based
> libraries from an
> > object oriented scripting language with no bindings
> for GObject and
> > GObject based libraries currently.
> > 
> > 
> > How does one go about creating GObject bindings for
> another language?
> > I've read the GObject-Introspection pages at gnome.org
> and looked at
> > the
> > PyGobject binding, but I still don't have a clear idea
> of where to
> > start.
> 
> Which language?  Have you ever done bindings in that
> language before?  Usually you would wrap a library by
> making equivalent API calls in that language and marshaling
> API parameters and results using the glue C/C++ libraries
> that the language provides for creating modules.  More
> complex libraries usually have some sort of automation for
> this and some languages have generic automated 
> binding tools like SWiG.  With the advent of
> GObject-Introspection you can now write a minimal interface
> module that reads in the gir files and routes and marshals
> method calls based on the gir data structure. 
> PyGObject is a poor library to look at because it does not
> yet use GObject-Introspect and does the wrapping with its
> own targeted tool.  It is better to look at the Gjs or
> Seed javascript bindings.  Every language is going to
> be different as they all have their own API for creating C
> extension modules so again, you need to know how to wrap a
> simple library in your language before tackling GTK+.
> 
> --
> John (J5) Palmieri
> Software Engineer
> Red Hat, Inc.
> 





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