I have this C wrapper 

DMatch* cv_create_DMatch3(int _queryIdx, int _trainIdx, float _distance) {
    return new DMatch(_queryIdx, _trainIdx, _distance);
}


it is a wrapper for these struct members

http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_descriptor_matchers.html?highlight=dmatch#DMatch


here is my lisp wrapper for it:

(defctype dmatch :pointer)

(defcfun ("cv_create_DMatch3" dmatch3) (:pointer dmatch) 
  "DMatch constructor"
  (-query-idx :int)
  (-train-idx :int)
  (-distance :float))

In C I can do this:

  DMatch* a = cv_create_DMatch3(1, 2, 3.0);
  cout << a->distance ;

and the output is 3

but in lisp when I do this:

(defparameter a (dmatch3 1 2 3f0))

LCV> (mem-aref a :int 0) 
1
LCV> (mem-aref a :int 1) 
2
LCV> (mem-aref a :float 2) 
#<SINGLE-FLOAT quiet NaN> <--- this is output


Any help on figuring out the reason would be much appreciated
_______________________________________________
Cffi-devel mailing list
Cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to