[Cffi-devel] Possible mem-aref bug or maybe my error on accessing member of a pointer to a struct
Joeish W
joeish80829 at yahoo.com
Thu Apr 24 06:16:54 UTC 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20140423/3993d061/attachment.html>
More information about the cffi-devel
mailing list