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

Albert Strasheim fullung at gmail.com
Fri Apr 28 02:39:03 CDT 2006


Hello all

I've collected the information from this thread along with links to some
recent threads on writing C extensions on the wiki at:

http://www.scipy.org/Cookbook/C_Extensions

Feel free to contribute!

Regards,

Albert

> -----Original Message-----
> From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-
> discussion-admin at lists.sourceforge.net] On Behalf Of Gennan Chen
> Sent: 27 April 2006 21:23
> To: David M.Cooke
> Cc: Numpy-discussion at lists.sourceforge.net
> Subject: Re: [Numpy-discussion] newbie for writing numpy/scipy extensions
> 
> Got it. Looks like ndimage still used the old one.
> 
> 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
> 
> 
> On Apr 27, 2006, at 11:31 AM, David M. Cooke wrote:
> 
> > Gennan Chen <gnchen at cortechs.net> writes:
> >
> >> 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?
> >
> > What is the compiler error message?
> >
> >> 2.  which import I should use in my initial function:
> >>
> >> import_array()
> >
> > This one. It's the one to use for Numeric, numarray, and numpy.
> >
> >> or
> >> import_libnumarray()
> >
> > This is for numarray, the other Numeric derivative. It pulls in the
> > numarray-specific stuff IIRC.
> >
> > --
> > |>|\/|<
> > /---------------------------------------------------------------------
> > -----\
> > |David M. Cooke                      http://
> > arbutus.physics.mcmaster.ca/dmc/
> > |cookedm at physics.mcmaster.ca





More information about the Numpy-discussion mailing list