[fetter-devel] unnamed bit fields

Andras Simon asimon at math.bme.hu
Sat Sep 10 16:35:54 UTC 2005


The following (from waistatus.h on Linux)

     struct
       {
         unsigned int __w_termsig:7; /* Terminating signal.  */
         unsigned int __w_coredump:1; /* Set if dumped core.  */
         unsigned int __w_retcode:8; /* Return code if exited normally.  */
         unsigned int:16;
       } __wait_terminated;

(a member of a union) is translated to

(cffi:defcstruct wait-anonymous338 (--w-termsig :unsigned-int)
  (--w-coredump :unsigned-int) (--w-retcode :unsigned-int) ( :unsigned-int))

and causes

error while parsing arguments to DESTRUCTURING-BIND:
   invalid number of elements in
     (:UNSIGNED-INT)
   to satisfy lambda list
     (CFFI::SLOTNAME TYPE &OPTIONAL (COUNT 1)):
   between 2 and 3 expected, but 1 found
    [Condition of type SB-KERNEL::ARG-COUNT-ERROR]

in sbcl. I don't know how cffi expects bit-field definitions (or
whether it supports them in the first place).

The way I got it here is via

(defbinding "pcre-library"
 	    (nicknames "pcre")
 	    (include "pcre.h")
 	    (export "match" "imatch" "pcre-info" "pcre-compile"
                     "pcre-exec" "pcre-version")
 	    (override ""))

and

(verrazano:create-binding
 	  (verrazano:setup-build "gccxml"
 			         "/tmp/")
 	  "/tmp/pcre.binding"
 	  "/tmp/pcre-library.lisp"
 	  :cffi-backend
 	  nil)

Andras



More information about the fetter-devel mailing list