[Numpy-discussion] embedded PyArray_FromDimsAndData Segmentation Fault
Wed May 14 17:42:05 CDT 2008
the PyArray_FromDimsAndData is still cousing me headaches.
Is there anybody out there finding the error of the following code?
int main(int argc,char** argv)
int dimensions = 2;
void* value = malloc(sizeof(double)*100);
int* size = (int*)malloc(sizeof(int)*2);
size = 10;
size = 10;
((double*)value)[i] = 1.0;
PyArray_FromDimsAndData(dimensions,size,NPY_DOUBLELTR,(char*)value); //TROUBLE HERE
I allway get a segmentation fault at the PyArray_FromDimsAndData call.
I want to create copies of c arrays, copy them into a running python interpreter as nd-arrays and modify them with some python functions.
If I did this in a module, I would have to call the
function, I know. However, this is all outside of any module and when I add it before PyArray_FromDimsAndData I get the following compilation error:
src/test.cpp:24: error: return-statement with no value, in function returning 'int'
Does anybody have a clue?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion