Hi all,<div><br></div><div>I&#39;d like to make an int* pointer stored in one Pyrex object available to another:</div><div><br></div><div><div>cdef class NumberHolder:</div><div>&nbsp;&nbsp; &nbsp;cdef int number</div><div>&nbsp;&nbsp; &nbsp;def __init__(self):</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;self.number = 0</div><div><br></div><div>cdef class PointerHolder:</div><div>&nbsp;&nbsp; &nbsp;cdef int* my_pointer</div><div>&nbsp;&nbsp; &nbsp;def __init__(self, number_holder):</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;my_pointer = number_holder.number</div>
</div><div><br></div><div>If I try it this way, of course, I get errors like &#39;NumberHolder&#39; object has no attribute &#39;number&#39;. I&#39;m currently creating a NumPy array in NumberHolder and using PyArray_DATA from PointerHolder, but it seems excessive and possibly dangerous, since PointerHolder may change *my_pointer later. What&#39;s the best way to do this?<br>
</div><div><br></div><div>Thanks,</div><div>Anand</div><div><br></div><div><br></div>