[SciPy-dev] Creating a swig C++ wrapper with numpy.distutils

Robert Kern robert.kern@gmail....
Mon Apr 7 13:35:36 CDT 2008

On Mon, Apr 7, 2008 at 5:19 AM, Matthieu Brucher
<matthieu.brucher@gmail.com> wrote:
> hi,
> I'd like to create an extension with SWIG. By default, the extension is a C
> one, but I need to create a C++ one with swig, that is adding the -c++ flag
> to the swig commandline. With setuptools, I just have to add the argument
> options={'build_ext':{'swig_opts':'-c++'}} to the setup() command.
>  Is there something like this in numpy.distutils ? If yes is it possible to
> add the option only to one extension with the configuration tool ?

Don't add swig_opts to the build_ext command; it affects every SWIG
wrapper, which may not be what you want. Instead, add swig_opts='-c++'
to the Extension() constructor (or add_extension() method call) of the
extension that needs it.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Scipy-dev mailing list