[Python-Dev] #ifdef __cplusplus?

Nick Coghlan ncoghlan at gmail.com
Fri Jan 2 00:54:38 CET 2009


Ulrich Eckhardt wrote:
> Hi!
> 
> There are lots of files that are framed with an extern "C" stanza when 
> compiled under C++. Now, I appreciate that header files are made suitable for 
> use with C++ with that, but WTF are those doing in .c files???

I believe it is to allow building the Python source as an embedded part
of an external application that is built with a C++ compiler, even when
that compiler isn't clever enough to realise that the 'extern "C"'
should be implied by the '.c' file extension.

I didn't add those lines though - I suggest doing an SVN annotate on
some of the affected source files, and looking at the associated checkin
comments.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list