[Numpy-discussion] ctypes, numpy-array

Christopher Barker Chris.Barker at noaa.gov
Tue Jul 25 12:27:09 EDT 2006


Lars Friedrich wrote:
> I would like to work with some data using python/numpy. The data is
> generated with C. To bring the data from C to python, I would like to
> use ctype. I am using python 2.4.3 on a windows-System.
> 
> To accomplish the described task, I have the following plan. Please tell
> me, if this is possible, respectively if there is a better way.
> 
> 1) In C, I write a .dll, that has a function
> int foo(PyObject *arg)

I'm a bit confused here. I thought the primary point of ctypes was to be 
able to access existing, non-python-aware dlls from Python without 
writing C code.

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?

Or use Pyrex, or Boost, or.....

Maybe ctypes has some real advantages I don't get.

-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