<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div>I'm trying to convert this declaration of an array of points to CFFI but I'm getting unhandled memory fault errors Directly below this C declaration is a tree of foreign-alloc functions I used to create this I'm hoping someone can check my work and tell me if it is my declaration that's the problem<br></div><div><br></div><div> Point pt[2][3];<br> pt[0][0].x = rng.uniform(x_1, x_2);<br> pt[0][0].y = rng.uniform(y_1, y_2);<br> pt[0][1].x = rng.uniform(x_1, x_2);<br> pt[0][1].y = rng.uniform(y_1, y_2);<br> pt[0][2].x = rng.uniform(x_1, x_2);<br> pt[0][2].y = rng.uniform(y_1, y_2);<br> pt[1][0].x = rng.uniform(x_1, x_2);<br> pt[1][0].y =
rng.uniform(y_1, y_2);<br> pt[1][1].x = rng.uniform(x_1, x_2);<br> pt[1][1].y = rng.uniform(y_1, y_2);<br> pt[1][2].x = rng.uniform(x_1, x_2);<br> pt[1][2].y = rng.uniform(y_1, y_2);<br><br> const Point* ppt[2] = {pt[0], pt[1]};</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">(foreign-array-alloc #2A((501 10) (255 10) (501
255) (10 501)) '(:array :int 4 2)))<br><br><br>(d a (foreign-alloc :pointer :count 2 :initial-contents <br><br>(list <br> <br>(foreign-alloc :pointer :count 3 :initial-contents <br><br>(list <br> (foreign-alloc :pointer :initial-element <br> (point (uniform rng x-1 x-2) (uniform rng y-1 y-2)))<br><br>(foreign-alloc :pointer :initial-element
<br> (point (uniform rng x-1 x-2) (uniform rng y-1 y-2))) <br><br>(foreign-alloc :pointer :initial-element <br> (point (uniform rng x-1 x-2) (uniform rng y-1 y-2))))) <br><br><br>(foreign-alloc :pointer :count 3 :initial-contents <br><br>(list <br>
(foreign-alloc :pointer :initial-element <br> (point (uniform rng x-1 x-2) (uniform rng y-1 y-2)))<br><br>(foreign-alloc :pointer :initial-element <br> (point (uniform rng x-1 x-2) (uniform rng y-1 y-2))) <br><br>(foreign-alloc :pointer :initial-element <br>
(point (uniform rng x-1 x-2) (uniform rng y-1 y-2))))))))<br><br><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">Here is how I have point defined it works as intended. The uniform function works well in the point so I didn't post but will if necessary<br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family:
HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">;; Point* cv_create_Point(int x, int y)
<br>(defcfun ("cv_create_Point2" point2) (:pointer point)
<br> "Point constructor"
<br> (x :int)
<br> (y :int))
<br> <br><br></div></div></body></html>