Could use help wrapping opencv function?

Joeish W joeish80829 at yahoo.com
Sat Oct 5 16:00:46 UTC 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20131005/eddfb245/attachment.html>


More information about the cffi-devel mailing list