[Pyrex] when pyrex gets tough

Lenard Lindstrom len-l at telus.net
Mon Sep 3 20:29:03 CEST 2007


David McNab wrote:
> It's taught me one thing - Pyrex is a fine precision scalpel, while SWIG
> is a huge diesel chainsaw. Each has its own strengths and weaknesses.
>
> The latter, of course, is huge and heavy and can create one hell of a
> mess :)
>
> My yuv4mpeg wrapper, done in SWIG, results in a 450k .so file :|
>
> The one good thing about SWIG though is its brilliant and seamless C++
> support (hint hint!)
>
>   
But Pyrex generated C code does compile under C++. And by using various 
tricks C++ classes can be wrapped. So far C++ exceptions are not 
supported. And there is no way to declare new C++ classes other than 
methodless structs. I do not know if there is any convenient setup.py 
build_ext option for C++. If not then the Pyrex code is compiled to C 
with pyrexc.py, the 'c' suffix is changed to 'cpp', and the C++ source 
code is compiled with a C++ setup.py script.

-- 
Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list