[Numpy-discussion] newbie for writing numpy/scipy extensions

Gennan Chen gnchen at cortechs.net
Thu Apr 27 09:56:12 EDT 2006


Hi! All,

I just start writing my own python extension based on numpy. Couple  
of questions here:

1. I have some utility functions, such as wrappers for  
PyArray_GETPTR* needed be access by different extension modules. So,  
I put them in utlis.h and utlis.c. In utils.h, I need to include  
"numpy/arrayobject.h". But the compilation failed when I include it  
again in my extension module function, wrap.c:

#include "numpy/arrayobject.h"
#include "utils.h"

When I remove it and use

#include "utils.h"

the compilation works. So, is it true that I can only include  
arrayobject.h once?

2.  which import I should use in my initial function:

import_array()

or
import_libnumarray()

Gen-Nan Chen, PhD
Chief Scientist
Research and Development Group
CorTechs Labs Inc (www.cortechs.net)
1020 Prospect St., #304, La Jolla, CA, 92037
Tel: 1-858-459-9700 ext 16
Fax: 1-858-459-9705
Email: gnchen at cortechs.net






More information about the NumPy-Discussion mailing list