Joeish W <joeish80...@yahoo.com> writes: > Lisp code is here https://gist.github.com/W-Net-AI/11205892 > ... > LCV> (dotimes (ic (vector-rect-size faces)) > (setf n (%vector-rect-to-c-array faces)) > (rect-x (mem-aref n :pointer ic))) > > this is where it fails, rect-x, my Lisp wrapper for C wrapper for the > c++ Rect class member x in this statement isn't getting a Rect* so it > outputs error: Unhandled ;memory fault at #xC9000000D5. The > %vector-rect-to-c-array function is a wrapper for the c function in > the posted c/c++ code. It works as expected on everything else but the > vector<Rect> output of detectMultiScale.
This fails because `n` is a pointer the data of vector<Rect>. So it points to an array of Rect structures, NOT an array of Rect* (pointers to Rect). What would work (but I am advising against this), is: (rect-x (inc-pointer n (* ic SIZE_OF_RECT))) Where SIZE_OF_RECT is the size of the Rect struct. What you should do is look into `defcstruct` to properly wrap the Rect struct and start from there. Wim Oudshoorn. _______________________________________________ Cffi-devel mailing list Cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel