Can Python be compiled by a C++ compiler ?

Daniel Dittmar daniel.dittmar at sap.com
Wed May 12 11:46:42 EDT 2004


Helmut Jarausch wrote:
> having read http://www.python.org/doc/current/ext/ext.html by Guido
> van Rossum and Fred Drake,
> I got the impression I should compile Python with g++ since section
> 1.11 indicates that otherwise the constructor of a global or static
> object (of an extension in C++) won't be called.
>
> Now trying to build Python (CVS version) with g++ fails. E.g., one

You'll need to link Python using C++. This is necessary to include the C++
runtime. The individual .c files should be compiled with C.

I believe that using C++ for the link step is even the default choosen by
./configure. Otherwise, extensions such as wxPython wouldn't work out of the
box as they contain code written in C++.

Daniel






More information about the Python-list mailing list