[Numpy-discussion] How to export a CObject from NumPy to my own module?

NumPyStudent jens.marquard.ipsen at gmail.com
Wed Nov 24 12:35:34 EST 2010


Well, I believe I should problably use the PyArray_API instead
(http://www.velocityreviews.com/forums/t358140-re-dynamically-loaded-libraries.html),
since it seems it's implemented in NumPy for this exact reason(?).
Can anyone point me in the direction of a good step-step guide og using this
api to export function pointers from NumPy to your own modules?



NumPyStudent wrote:
> 
> Hi
> 
> I haven't worked very much with NumPy and Python and hope some assistance
> :-)
> 
> I need access to a functionpointer in my own Python module.
> This functionpointer is available in a modified NumPy module.
> I would like to pass the functionpointer to my module when I import it in
> the Python runtime.
> Before importing my module I've already imported the NumPy module, and
> this is fine by me -
> I don't necessarily need my own module to handle the import of NumPy...
> 
> My question concerns how I should modify NumPy source code to be able to
> use the method of passing CObjects as described here:
> http://docs.python.org/release/2.5.2/ext/using-cobjects.html
> 
> Can anyone tell me where I should add the C-Object in NumPy?
> I tried to add it to the "multiarray" module (in the file
> multiarraymodule.c), but it dosen't look like this module is available for
> import (as in PyImport_ImportModule("multiarray"); in my own module - the
> return value of this is null).
> However, if I try PyImport_ImportModule("numpy"); it seems like I get a
> module imported, but this module does not have the CObject added. This is
> not surprising, since I added it to the "multiarray" module.
> 
> I believe I can solve my problem by adding the CObject to the "numpy"
> module instead, but in what file or files should I make modifications to
> do this?
> 
> Alternatively, how can I make the "multiarray" module available for import
> by my own module?
> 
> BR.
> NumPyStudent
> 

-- 
View this message in context: http://old.nabble.com/How-to-export-a-CObject-from-NumPy-to-my-own-module--tp30295576p30298423.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list