[GRASS-dev] RE: [GRASS-user] Question with Python-SWIG example [SEC=UNCLASSIFIED]

Glynn Clements glynn at gclements.plus.com
Mon May 17 12:01:23 EDT 2010

Martin Landa wrote:

> > Ideally, I'd like to do the same in 6.x in time for 6.4.0, so that we
> > can forget that the SWIG version ever existed. The main issue there is
> > the vdigit and nviz modules in the wxPython GUI (which don't work on
> > Windows in any case). I haven't tried using ctypesgen for C++, though.
> +1
> BTW, compiling SWIG in trunk
> ctypesgen.py -I/usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/include
> -I/usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/include
> -L/usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/lib
> -L/usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/lib
> -lgrass_datetime
> /usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/include/grass/datetime.h
> /usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/include/grass/P_datetime.h
> -o date.py
> make[2]: ctypesgen.py: Command not found
> make[2]: *** [date.py] Error 127
> make[2]: Leaving directory `/usr/local/src/grass_trunk/lib/python/ctypes'
> make[1]: *** [default] Error 2
> make[1]: Leaving directory `/usr/local/src/grass_trunk/lib/python/ctypes'
> make: *** [default] Error 2

Building the swig directory is a no-op (the SUBDIRS list is empty). 
The above comes from building lib/python. I'll modify it to ignore
errors when building the ctypes subdirectory.

ctypesgen can be obtained via SVN:

svn checkout http://ctypesgen.googlecode.com/svn/trunk/ ctypesgen-read-only  

or you can get a tarball from:


To build:

	python setup.py build install

Although it's probably not as widespread as SWIG, it has the advantage
that both ctypesgen itself and the wrappers which it generates are
pure Python code, with no binary components.

I'm also going to look at ctypeslib:


I went with ctypesgen first as there's a supported Gentoo package for

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list