Hello,

Does anyone know why this code fails on a 64bit linux machine (it is
working on 32 just fine):
The compiler complains:

bit.c:792: warning: passing argument 3 of '*(PyArray_API + 744u)' from
incompatible pointer type

and I get a segmentation fault

If it is not an issue with Cython could you please direct me
somewhere, if have almost no C/C++ skill.

Thank you,
Marcin

#####
cimport numpy as np
ctypedef np.double_t DTYPE_t
from numpy cimport NPY_DOUBLE, NPY_UINT
from stdlib cimport malloc, realloc, free

cdef extern from "arrayobject.h":
    cdef object PyArray_SimpleNewFromData(int nd, int *dims,\
                                            int typenum, void *data)
    cdef void import_array()
import_array()

print sizeof(DTYPE_t)
print sizeof(void*)
print sizeof(DTYPE_t*)

cdef int i, k = 100
cdef DTYPE_t *dst = <DTYPE_t *>malloc(k * sizeof(DTYPE_t))
for 0 <= i < k:
    dst[i] = i
cdef np.ndarray dist = PyArray_SimpleNewFromData(1, &k, NPY_DOUBLE, <void*>dst)
print dist
####
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to