This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: creating goops classes in C library wrappers


Martin Soto <masoto@uniandes.edu.co> writes:

> Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se> writes:
> > Klaus Schilling <Klaus.Schilling@home.ivm.de> writes:
> > > This might influence guile-curses a lot, if one could define e.g a
> > > <window> class, and many generic functions wrapping curses library
> > > calls. It may be even better for libraries like gtk or some database
> > > libraries.
> > 
> > Yes.  Also note the possibility not to implement the window as a smob
> > but rather as a <foreign-object> (see undocumented example in
> > goops-core/fdi.c).  A <foreign-object> is a lisp cell with a pointer
> > to an arbitrary C struct in its CDR, just as a smob, so very little
> > resources are spended.  It is possible to define accessors for the
> > different fields in the struct on the C level.
> 
> What about defining goops methods from the C level as well?  From the
> fdi.c example it seems clear that you can easily provide accesors to
> the fields of the structure, but I can't see how to provide access to
> the C functions that work on that structure.  Particularly, I would
> like to be able to "define-generic" and "define-method" directly from
> the C level, and in such a way that the newly defined method is
> implemented in C.  Is that possible at all?

Yes, this could be made possible.

I'll implement this when I get time (it could take a while).

/mdj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]