Numeric - extending with C

Pete Shinners pete at shinners.org
Wed Jan 16 13:32:47 EST 2002


Jesper Olsen wrote:
> Today I downloaded and installed Numeric 20.3 from sourceforge.
> I installed it from source and have used it with python 2.1.1
> 
> Now I want to write and extention module. 
> The documentation for how to do this is is not hard to read.

when using the C api from a python library, the recommended way to set 
it up is to use a sort of 'lazy linking' method. it takes a bit of extra 
work on the library side, but folks who are using it hardly notice the 
difference. there is one thing you need to add to your init function, 
and you'll alway crash without it...


void initmytest(void)
{
     Py_InitModule("mytest", mytestMethods);
     import_array(); /*runtime "link" to Numeric*/
}




More information about the Python-list mailing list