guile-gtk-general
[Top][All Lists]
Advanced

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

Re: making a SCM from a GObject *


From: Peter Gavin
Subject: Re: making a SCM from a GObject *
Date: Fri, 13 May 2005 15:57:32 -0400

Ok, well, I figured out the problem. It wasn't a bug, I just didn't
realize scm_c_gtype_instance_to_scm wouldn't work w/out first doing
scm_c_use_module ("gnome gobject gobject"). Duhh :)

But now I've run into a new problem. How do I get the GType for a
GObject (or subclass) in Scheme? I tried using gtype-from-instance,
but that gave me an argument type error.
gtype-instance-primitive->type does the same thing, but it appears to
be implemented identically.

Pete

On 5/11/05, Andreas Rottmann <address@hidden> wrote:
> gregory benison <address@hidden> writes:
> 
> > I have had success using this method:
> > 1) Create a .defs file which describes your gobject - based header
> > file.  It describes all of your functions and custom types.  Look in
> > the guile-gnome distribution in the 'defs' directory for examples.
> > You can use the 'h2defs.py' program (found in the guile-gnome
> > distribution) to generate this file automatically from your headers,
> > if you have followed normal conventions in writing your headers.
> > 2) Process your .defs file to automatically create C-to-guile glue
> > code for your gobject types.  Look at any "*-spec.scm" file in the
> > guile-gnome distribution to see how this works.
> > 3) Compile the resulting C file into a shared library.  Load it from a
> > scheme interpreter, and your gobject type will be available to use
> > from scheme.
> >
> > ( guile-gnome experts: is this the right approach?? )
> >
> Yes, this is exactly how it works. Sometimes you have to do some extra
> C coding for functions that take callbacks, for instance.
> 
> Regards, Rotty
> --
> Andreas Rottmann         | address@hidden      | address@hidden | 
> address@hidden
> http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
> Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62
> v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com
> 
> I have a truly elegant proof of the  above, but it is too long to
> fit into this .signature file.
>




reply via email to

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