Could use help wrapping opencv function in CFFI?

Discussion of Common Lisp

Could use help wrapping opencv function in CFFI?

Postby joeish80829 » Sat Oct 05, 2013 9:02 am

Sat, Oct 5, 2013 at 9:00 AM
9:00 AM
Message starred


the function I'm trying to wrap is here





CV_INLINE CvPoint cvPoint( int x, int y )
{
CvPoint p;

p.x = x;
p.y = y;

return p;
}






and here is the related struct






typedef struct CvPoint
{
int x;
int y;
}
CvPoint;






I wrap it like this like I normally do



; this is how swig wrapped the defcstruct
(cffi:defcstruct cv-point
(x :int)
(y :int))





;; CvPoint cvPoint(int x, int y)
(cffi:defcfun ("cvPoint" pointy) (:struct cv-point)
"constructs CvPoint structure."
(x :int)
(y :int))




the wrapper i made runs at the repl but when i call the function i get error



CL-OPENCV> (point 7 7)


The value NIL is not of type SB-SYS:SYSTEM-AREA-POINTER.
[Condition of type TYPE-ERROR]



Backtrace:
0: (CFFI::CALL #.(SB-SYS:INT-SAP #X7FFFE0000E10) NIL #.(SB-SYS:INT-SAP #X7FFFE5427FD0) #.(SB-SYS:INT-SAP #X7FFFE5427FD8))
Locals:
SB-DEBUG::ARG-0 = #.(SB-SYS:INT-SAP #X7FFFE0000E10)
SB-DEBUG::ARG-1 = NIL
SB-DEBUG::ARG-2 = #.(SB-SYS:INT-SAP #X7FFFE5427FD0)
SB-DEBUG::ARG-3 = #.(SB-SYS:INT-SAP #X7FFFE5427FD8)




in the backtrace it appears to be linking 4 parameters and i think its because of this



CV_INLINE CvPoint cvPoint( int x, int y )
{
CvPoint p;

p.x = x;
p.y = y;

return p;
}




because their are 4 items in the CV_INLINE


I was hoping someone could help me get by this error message
joeish80829
 
Posts: 153
Joined: Tue Sep 03, 2013 5:32 am

Return to Common Lisp

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests