size_t questions
Stelian Ionescu
sionescu at cddr.org
Wed Apr 15 00:42:35 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.
That is a mistake, size_t is the same size as the pointer so your manual definition is correct.
--
Stelian Ionescu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20200414/44522e58/attachment.htm>
More information about the cffi-devel
mailing list