[cffi-devel] cffi:defcstruct, cffi:foreign-string-to-lisp question

Luís Oliveira luismbo at gmail.com
Wed Dec 17 16:47:42 UTC 2008


On Wed, Dec 17, 2008 at 2:45 PM, mosi <amosat+python at gmail.com> wrote:
> (cffi:foreign-string-to-lisp name 32)
> (cffi:foreign-string-to-lisp name 12)
>
> this works, the correct output is presented. But how can I get the length of
> the char in the cstruct PPP?

Sounds like the string is not null terminated, so you really need to
specify the length. If you want to inspect the struct type definition
you can use something like this:

  (slot-count (get-slot-info 'ppp 'name)) => 32

Anyway, Frode Fjeld's library "Binary-Types" might be a better
solution for your problem: <http://www.cliki.net/Binary-types>.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list