[cffi-devel] How do i cast variables
Martin Simmons
martin at lispworks.com
Wed Oct 23 10:21:22 UTC 2013
>>>>> On Tue, 22 Oct 2013 15:48:50 -0700 (PDT), Joeish W said:
>
> take this for instance
>
> CvPoint points[2];
>
>
> id like to be able to cast points[2] to the CvPoint struct more info here http://docs.opencv.org/modules/core/doc/old_basic_structures.html?highlight=cvpoint#CvPoint
>
>
> here is my struct which works for other things
>
>
>
> ;; (cffi:foreign-type-size '(:struct cv-point)) = 8
> (cffi:defcstruct cv-point
> (x :int)
> (y :int))
>
>
> put in a defparameter you cant just go
>
> (defparameter points (cffi:foreign-alloc :int :count 2))
>
> (defparameter a ((:struct cv-point) points))
>
>
> you get an illegal function call error...any help is appreciated
Your example is inconsistent -- in C, your points variable is an array of two
CvPoints, but in Lisp it is an array of two ints.
What are you really trying to do?
I suggest you post the C code that you are trying to convert. The opencv doc
for CvPoint doesn't use casting or arrays of ints.
__Martin
More information about the cffi-devel
mailing list