[Pyrex] Pyrex idioms and optimizations?

Sven Berkvens-Matthijsse sven at pyrex.berkvens.net
Thu Jul 26 21:21:15 CEST 2007


> Chris Mellon wrote:
> > On 7/26/07, William Stein <wstein at gmail.com> wrote:
> >   
> > MSVC is a C++ compiler, and only incidently a C compiler, so the
> > inline specifications that cython generates are syntax errors there.
> > Using a macro for it so it be a noop on MSVC would probably be best.
> >   
> Is VC 7 C99 compliant? Maybe it needs some command line option set.
> Anyway "inline" is spelled "__inline" (two leading underscores) in
> VC 6.  That should still work.

Wouldn't it work if you say, at the beginning of each generated file:

#ifdef __cplusplus
extern "C" {
#endif

and at the end:

#ifdef __cplusplus
}
#endif

This should force a C++ compiler to treat the code as C, not C++. I
would've thought that the C++ compiler would understand that it was
handling C code from the file's extension ".c", but apparently that
isn't the case with MS tools.

> -- 
> Lenard Lindstrom
> <len-l at telus.net>

-- 
Regards,
Sven



More information about the Pyrex mailing list