My extension code generator for C++
Thomas Jollans
thomas at jollans.com
Sat Jul 3 13:54:47 EDT 2010
On 07/03/2010 07:22 PM, Rouslan Korneychuk wrote:
> It's still in the rough, but I wanted to give an update on my C++
> extension generator. It's available at http://github.com/Rouslan/PyExpose
Question that pops to mind immediately: How does this differentiate
itself from SWIG? ( I can't say I'm familiar with SWIG, but the question
had to be posed. )
>
> The documentation is a little slim right now but there is a
> comprehensive set of examples in test/test_kompile.py (replace the k
> with a c. For some reason, if I post this message with the correct name,
> it doesn't show up). The program takes an input file like
>
> <?xml version="1.0"?>
> <module name="modulename" include="vector">
> <doc>module doc string</doc>
>
> <class name="DVector" type="std::vector<double>">
> <doc>class doc string</doc>
> <init overload=""/>
> <init overload="size_t,const double&"/>
> <property name="size" get="size" set="resize"/>
> <def func="push_back"/>
> <def name="__sequence__getitem__" func="at"
> return-semantic="copy"/>
func="operator[]" would also work, I assume?
> <def name="__sequence__setitem__" assign-to="at"/>
> </class>
> </module>
>
> and generates the code for a Python extension.
>
> [snip]
>
> I'm really interested in what people think of this little project.
How does it deal with pointers? What if something returns a const
pointer - is const correctness enforced?
All in all, it looks rather neat.
Thomas
More information about the Python-list
mailing list