[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Inheriting from C++ in Chicken
From: |
John Lenz |
Subject: |
Re: [Chicken-users] Inheriting from C++ in Chicken |
Date: |
Tue, 21 Dec 2004 00:08:58 +0000 |
On 12/20/04 03:33:20, Joel Reymont wrote:
Folks,
I successfully wrapped the guichan (http://guichan.darkbits.org) library
in Chicken using SWIG wrappers. I also wrapped the SDL while I was at it.
Guichan has a base Widget class. I'd prefer to extend this class in
Scheme rather than in C++. What's the easiest way to achieve this?
It seems to me that the simplest way to accomplish this is by generating
custom C++ code , i.e. making a pass on the TinyCLOS code to generate the
wrapper C++ class.
Am I right here? Are there any examples of Scheme code parsing Scheme
code? Is the Chicken compiler code easy to adopt here or should I just do
this in a totally different manner?
SWIG supports this in other language modules, python, ruby, java. It is
called directors, and is cross language polymorphism.
Check out the python section of the swig docs,
http://www.swig.org/Doc1.3/Python.html#directors
The java section has some stuff about it as well.
You can also check out some of the examples in SWIG. That is, look at
Examples/python/extend
Lastly, here is a little more info, but some of it in here might be
obsolete. This is the original proposal for the feature
http://stm.lbl.gov/~tm2/swig/ProxyDoc.html
It is on my TODO list to add something like this to chicken and guile.
Most of the support in SWIG is there, just the few language specific parts
need to be written.
In any case, they provide one possible way and you might want to research
it.
John