[GRASS-dev] grass/wx 6.4 problems on Debian sid.

Glynn Clements glynn at gclements.plus.com
Thu Oct 8 08:11:41 EDT 2009


Francesco P. Lovergine wrote:

> > The other option is to abandon SWIG in favour of Python's ctypes
> > module. This is more work, but it's also more flexible, and will
> > produce a better result in the end.
> > 
> > It may even be possible to automate the wrapper generation. While this
> > won't be perfect, neither is SWIG; any automatic approach has the
> > problem that a C prototype doesn't contain enough information.
> 
> I opened a ticket #782 about that, just to leave trace of the problem.
> BTW, the wrapper generation _is_ automated by means of swig currently: 
> that's exactly the problem here :)

SWIG generates C or C++ code for a binary extension module. This is
sensitive to the version of Python installed.

If anything, providing SWIG-generated wrappers to the user will be
worse for compatibility. While it isn't guaranteed that the user's
SWIG is compatible with the user's Python, it's even less likely that
the developer's SWIG will be compatible with the user's Python.

ctypes wrappers are pure Python code, which means that they can adapt
to the version of Python used at run-time if necessary.

If the wrappers were auto-generated, this would be a one-time
operation. The wrappers would be source code, not intermediate files
which are generated as part of the build process, and would be updated
manually if the library changed.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list