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
Point pt[2][3];
pt[0][0].x = rng.uniform(x_1, x_2);
pt[0][0].y = rng.uniform(y_1, y_2);
pt[0][1].x = rng.uniform(x_1, x_2);
pt[0][1].y = rng.uniform(y_1, y_2);
pt[0][2].x = rng.uniform(x_1, x_2);
pt[0][2].y = rng.uniform(y_1, y_2);
pt[1][0].x = rng.uniform(x_1, x_2);
pt[1][0].y =
rng.uniform(y_1, y_2);
pt[1][1].x = rng.uniform(x_1, x_2);
pt[1][1].y = rng.uniform(y_1, y_2);
pt[1][2].x = rng.uniform(x_1, x_2);
pt[1][2].y = rng.uniform(y_1, y_2);
const Point* ppt[2] = {pt[0], pt[1]};
(foreign-array-alloc #2A((501 10) (255 10) (501
255) (10 501)) '(:array :int 4 2)))
(d a (foreign-alloc :pointer :count 2 :initial-contents
(list
(foreign-alloc :pointer :count 3 :initial-contents
(list
(foreign-alloc :pointer :initial-element
(point (uniform rng x-1 x-2) (uniform rng y-1 y-2)))
(foreign-alloc :pointer :initial-element
(point (uniform rng x-1 x-2) (uniform rng y-1 y-2)))
(foreign-alloc :pointer :initial-element
(point (uniform rng x-1 x-2) (uniform rng y-1 y-2)))))
(foreign-alloc :pointer :count 3 :initial-contents
(list
(foreign-alloc :pointer :initial-element
(point (uniform rng x-1 x-2) (uniform rng y-1 y-2)))
(foreign-alloc :pointer :initial-element
(point (uniform rng x-1 x-2) (uniform rng y-1 y-2)))
(foreign-alloc :pointer :initial-element
(point (uniform rng x-1 x-2) (uniform rng y-1 y-2))))))))
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
;; Point* cv_create_Point(int x, int y)
(defcfun ("cv_create_Point2" point2) (:pointer point)
"Point constructor"
(x :int)
(y :int))