[Pyrex] Problems with compiling a module using a C++ compiler

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Aug 11 05:40:07 CEST 2003


> I have a problem with Pyrex 0.8.2 on Windows (XP) and VC6. When I try to 
> compile Pyrex generated C code actually using the C++ compiler

That is not supported. Pyrex (currently) generates C code, 
not C++ code!

> The problem is the cast on the left hand side. I've never seen that
> before and don't know if this is valid C/C++ code.

I'm not entirely certain whether it's valid C code either, but
all the C compilers I have experience with seem to accept it.
Changing Pyrex to not generate lvalue casts would be tricky,
and I'd rather not do it until I have to. Although it looks
like I may have to if/when I eventually get around to adding
C++ support, if it turns out that this is illegal in C++.

> I'm using the .cpp suffix because I'm trying to wrap a C++ library
> which has to be compiled using a C++ compiler (and needs the C++
> runtime library).

The recommended way to do that at the moment is to write a
C wrapper for the C++ library and then wrap that with Pyrex.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list