[cffi-devel] What do i do with a c "bool" return type

Luís Oliveira loliveira at common-lisp.net
Sat Nov 23 23:50:45 UTC 2013


On Mon, Nov 18, 2013 at 3:56 PM, Joeish W <joeish80829 at yahoo.com> wrote:
> bool cv_VideoCapture_isOpened0(VideoCapture* self) {
>     return self->isOpened();
> }
>
> (cffi:defcfun ("cv_VideoCapture_isOpened0" %vid-cap-cam-is-open) :pointer
>   (self (:pointer video-capture)))

Try :boolean rather than :pointer. The :boolean CFFI type maps between
C ints and Lisp booleans. Double check that bool is an int typedef on
your platform; the definition should be in stdbool.h.

HTH,

-- 
Luís Oliveira
http://kerno.org/~luis/



More information about the cffi-devel mailing list