[Pyrex] New Distutils implementation for Pyrex.

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Aug 12 04:56:25 CEST 2007


Robert Bradshaw wrote:
> From what I understand, Pyrex doesn't do anything special to  
> generate c vs. c++ code

It does make some differences, for example 'extern'
declarations that aren't from a .h get wrapped in
'extern "C"' when Pyrex is operating in C++ mode.
The number of differences may also increase as I add
more C++ features.

But even without that, there are cases where the
options need to be different. For example, suppose
I have moof.pyx which uses two other pieces of
code, flub.cpp which is written in C++, and zax.c
which is plain C. My moof.pyx needs to generate C++
so that it can make use of the things in flub.cpp.
So I have an extension made up of three files:

    moof.pyx    must be translated in C++ mode
    flub.cpp    must be compiled as C++
    zax.c       must *not* be compiled as C++

If there is only one language option, and I use it
to tell Pyrex to use C++ mode, then it will also
compile zax.c as C++, which is wrong.

--
Greg



More information about the Pyrex mailing list