[Numpy-discussion] how to include numpy headers when building an extension?

Christopher Barker Chris.Barker at noaa.gov
Tue Sep 11 15:02:14 EDT 2007


Travis E. Oliphant wrote:
> Christopher Barker wrote:
>> [OT: why the heck do none of the SWIG docs give examples (or even 
>> suggest) using distutils for building SWIG extensions???]
> 
> I'm pretty sure this is because the people who contributed to the SWIG 
> docs the most are not currently using numpy.distutils

Actually, I'm talking about the general SWIG docs -- that have nothing 
to do with numpy at all. They've got you calling gcc on the command 
line, which I haven't done for years!

But while we're on the topic, I started this be looking at the swig 
examples that come with numpy. It would be really great if there was a 
complete, very simple, sample or two complete with c code, *.i files, 
and setup.py. There are the tests, which built and ran fine for me, but 
that's a bit of a complicated mess.

Anyway, I'm working on some simple samples -- I'll contribute them when 
I get them working!

OT:
The struggle at the moment is building a C++ extension -- if I use 
straight C, a trivial sample works, if I call the file *.cpp, swig it 
with -c++, I get a *_wrap.cxx file that won't build. Do I have to do 
something different in the setup.py?

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list