[Pyrex] Header file/declaration redundancy

Simon Burton simon at arrowtheory.com
Fri Oct 28 02:38:37 CEST 2005

On Thu, 27 Oct 2005 15:19:11 +1300
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> > In other words, it is obviously essential to declare which symbols
> > should be made available to Pyrex code, or exposed as module symbols,
> > but it seems that Pyrex code can be made a lot more robust by not having
> > to retype all the definitions from included header files.
> It would certainly be better if more information could
> be extracted automatically from the headers, but it
> would be very difficult to automate this fully, for
> reasons having mainly to do with the C preprocessor.
> A couple of people are working on tools to help with
> this, but I haven't heard from them for a while. 

Yes, i've been toiling over this on and off for a while [1] and
recently convinced my boss to let me develop this so
that we could wrap some fairly large c libraries [2][3]. What we
have now works well. It looks a lot like ctypes (or SWIG): all of the
basic c types are exposed; pointers, arrays, and pointer arithmetic.
I've been experimenting around with different ways of doing type
checking/adaptation (this is where SWIG becomes dicey),
callbacks, and recently had success mapping typedefs to class inheritance.

As soon as I'm happy that it (pyxelator: [4]) is reasonably stable we will write
some docs and release it.

bye for now,


[1] http://lists.copyleft.no/pipermail/pyrex/2003-October/000326.html
[2] http://www-unix.mcs.anl.gov/petsc/petsc-as/
[3] https://lineal.developer.nicta.com.au/
[4] https://lineal.developer.nicta.com.au/pyxelator

Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Ph. 61 02 6249 6940

More information about the Pyrex mailing list