Mark Heslep schrieb: > Travis Oliphant wrote: >> Mark Heslep wrote: >>> I don't see a clean way to create a numpy array from a ctypes pointer >>> object. Is the __array_interface_ in ctypes the thing thats missing >>> needed to make this happen? I've followed Albert's Scipy cookbook >>> on ctypes here >>> >>> On the C side the PyArray_SimpleNewFromData( ..dimensions, ...data >>> ptr) C API does the job nicely. Is there a ctypes paradigm for >>> SimpleNew...? >>> >> Can you somehow call this function using ctypes? >> >> -Travis > That might work, though indirectly. As I think I understand from ctypes > docs: Ctypes uses functions exposed in a shared library, macros > existing only a header are not available. If its PyArray... is a macro > then I a) need to compile and make a little library directly from > arrayobject.h or b) need to use the root function upon which the macro > is based, PyArrayNew?
Sure, macros will not work. > ctypes has built-in access to the functions in the core python library, > but Im not sure which library contains all the PyArray API calls, since > its all typically hidden by distutils and setup.py On Linux it doesn't matter, since you don't need to know which library exports a function (If I understand shared libs in Linux correctly). At least dlsym can be called with a NULL handle. On windows, functions can only be retrieved from exactly the library that exposes them. Plus, the function must explicitly marked exported either by compiler directives in the source code of by listing them in a .def file. Thomas ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion