Embedding a Numeric array in C

Jochen Küpper jochen at jochen-kuepper.de
Mon May 20 22:07:47 EDT 2002


On 20 May 2002 14:11:54 -0700 Chris Fonnesbeck wrote:

Chris> I am trying to find out how to properly embed a Numeric array type in
Chris> C.  The following code compiles, but segfaults when run:

I have only done it in C extensions to python programs, but the
following from the NumPy manual, "writing C extensions" should also
apply to your problem:
,----
| In addition to including arrayobject.h , the extension must call
| import_array() in its initialization function, after the call to
| Py_InitModule() . This call makes sure that the module which
| implements the array type has been imported, and initializes a pointer
| array through which the NumPy functions are called. If you forget this
| call, your extension module will crash on the first call to a NumPy
| function.
`----

Greetings,
Jochen
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: 44BCCD8E
        Sex, drugs and rock-n-roll



More information about the Python-list mailing list