Here is the C wrapper for vector<Mat> which is just a typename for a C++ vector:

vector_Mat* std_carrayTovectorm(Mat* a, size_t len) {
    vector<Mat>* v = new vector<Mat>;
    for(size_t i = 0; i < len; i++)
        v->push_back(a[i]);
    return v;
}

Here is my wrapper in CFFI:

;; vector_Mat*
(defctype vector-mat :pointer)

(defcfun ("std_carrayTovectorm" %c-arr-to-vector-mat) (:pointer vector-mat)
  (a (:pointer mat))
  (len :unsigned-int))

When I use it as below I get "unhandled memory fault error",  If anyone can check my work I would be much appreciative. I can post my mat-value wrapper if necessary. It works fine though.


(%c-arr-to-vector-mat (foreign-alloc :pointer :initial-contents(list  (mat-value 4 4 +32s+ (scalar 1 2 3)) (mat-value 4 4 +32s+ (scalar 1 2 3)))) 1)