[Prev][Next][Index][Thread]
Re: SWIG and C++
On Wed, 3 Jan 2001 23:00:03 -0500 (EST), "Shawn" <shawn@anarchy-arts.com>
wrote:
> Does someone know how to integrate SWIG and Dylan, i.e. to create an
> extension for SWIG that would wrap C++ code for use in Dylan ? SWIG has
> extensions for szscheme "whatever that is" Python, TCL, Guile "???", Ruby.
> Ruby looks interesting but it has virtually nil examples or tutorials.
SWIG parses (annotated) C/C++ header files and emits wrappers so that they
can be used from other languages. It appears that SWIG 1.1/1.3 is written
in C++ (although they are doing a rewrite in C) so probably the backend
modules also need to be written in C++ (although I suppose you could use
SWIG itself to generate wrappers for its own backend API!). It is possible
that the backend modules are routinely written in something else, eg
OmniORB3's CORBA IDL compiler is written in C++ but its backends are
written in Python.
For FunDev you would need to write this backend so that it walked over
whatever internal representation SWIG has for the headers it parses -- or
you you might just have to write callbacks which are called from a more
generic walker. I don't know.
The backend would have to emit Dylan FFI declarations. See FunDev's FFI
manual. These Dylan FFI declarations would then compiled by the Dylan
compiler in the usual way.
If this were done by FunO they would be able to add knowledge of SWIG into
the IDE's build system so that you could add ".i" files to projects in the
same way that you can ".idl" files.
If I were doing it I would look for a SWIG backend that might be similar
(eg a Java one) and do surgery on that until it emitted Dylan FFI
declarations instead of JNI declarations.
__Jason
References: