Hello,
From the CFFI manual, Section 4.9, I understand that
"Implementor’s note: size_t is almost always an unsigned int.”
However, this seems to fail on a 64 bit Linux computers, where the C ints are 32 bit
I’ve had better success with
(cffi:defctype size_t #.(cond ((= 4 (cffi:foreign-type-size :pointer)) :uint32) ((= 8 (cffi:foreign-type-size :pointer)) :uint64) (t (error "Failed type lisp-pointer-type"))))
Is this general enough to be trusted everywhere? If so, should it be part of CFFI, or at least mentioned in the manual? The current text in the manual doesn’t seem to be working for me, and this is a frequent issue when I port a new foreign library and forget what I did in the past … first thing I do is (apropos “size-t” :cffi) and (apropos “size_t” :cffi) and nothing shows up.
That is a mistake, size_t is the same size as the pointer so your manual definition is correct.
-- Stelian Ionescu