[Numpy-discussion] ctypes, numpy-array

Christopher Barker Chris.Barker at noaa.gov
Tue Jul 25 14:46:54 EDT 2006


Lars Friedrich wrote:
>> In this case, you're writing a dll that understands PyObjects (or, I 
>> assume, a particular PyObject -- a numarray). Why not just forget ctypes 
>> and write a regular old extension?
> good point. I am relatively new to Python. The first thing I did was
> trying to write a regular extension. The problem is, that I *have to*
> use a windows-machine. And at the moment, only Visual C++ 6.0 is
> available here. The problem is that for a regular extension, Python and
> the extension need to be compiled by the same compiler AFAIK.

That's mostly true. You have three options:

1) re-compile python yourself -- but then you'd also have to re-compile 
all the other extensions you use!

2) You can also use MingGW to compile extensions -- it takes a bit of 
kludging, but it can be done, and works fine once you've got it set up. 
Google will help you figure out how -- it's been a while since I've done it.

I have to say that I find it ironic that you can use MinGW, but not 
other versions of the MS compiler!

3) MS distributes a command line version of their compiler for free that 
can be used. Again, google should help you find out how to do that.


However, as other posters mentioned, you can use ctypes as it was 
intended with numpy -- that may be the way to go

-Chris






-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (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