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

Glynn Clements glynn at gclements.plus.com
Tue May 11 11:42:59 EDT 2010


Andrew MacIntyre wrote:

> From the SWIG examples I inferred the following type references for 
> the pointers in question:
> 
> CELL*  =>  SWIGTYPE_p_CELL
> FCELL*  =>  SWIGTYPE_p_FCELL
> DCELL*  =>  SWIGTYPE_p_DCELL
> 
> provided that CELL*/FCELL*/DCELL* are typedef'ed.
> 
> So I expected that in pyobj_to_ptr() you could do something like

But I still don't see what happens when a function returns a CELL*
which is subsequently passed to a function accepting a void*, or
vice-versa. This is common enough that if SWIG can't handle it, we
need to use something other than SWIG.

But, to be honest, even if SWIG can handle it, I'd prefer something
which generates pure Python wrappers.

> > I think that I'm not going to put any more effort into the SWIG
> > wrapper unless usable documentation materialises. In the meantime, I'm
> > going to look for alternatives.
> 
> If you decide to investigate using ctypes, the following links might be
> of interest:
> 
> - http://starship.python.net/crew/theller/ctypes/old/codegen.html

AFAICT, this has been superseded by ctypeslib:

	http://pypi.python.org/pypi/ctypeslib/

> - http://www.language-binding.net/pygccxml/pygccxml.html

I wasn't aware of this one.

I also found ctypesgen:

	http://code.google.com/p/ctypesgen/

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


More information about the grass-dev mailing list