[Numpy-discussion] c api, ndarray creation

Sergey Petrov qweqwegod at yahoo.com
Tue Nov 5 13:55:15 EST 2013


On Tue, 05 Nov 2013 23:22:37 +0500, Robert Kern <robert.kern at gmail.com>  
wrote:

> numpy is not a C library. It is a Python extension module. You can use  
> its C API from other Python extension modules, not C >main programs. You  
> have not started a Python interpreter or imported the numpy module. Only  
> then will the numpy API be >available.
>
> Mechanically speaking, the proximate cause of your segfault is that  
> `PyArray_SimpleNewFromData` is not actually a function, >but a macro  
> that looks up a function pointer from a static table defined in the  
> numpy module. Calling the macro >`import_array()` will import the numpy  
> module set up this table with the correct function pointers. But you  
> first need a >Python interpreter running.
>

I just tried, apparently in vain, to simplify example. Thanks for detailed  
answer!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20131105/de667a76/attachment.html>


More information about the NumPy-Discussion mailing list