size_t questions

JTK jetmonk at gmail.com
Tue Apr 14 23:52:34 UTC 2020


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.

Best regards,
J.K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20200414/e3485f3f/attachment.htm>


More information about the cffi-devel mailing list