[cffi-devel] void arg type
Brad Anderson
brad at sankaty.com
Thu Jan 12 21:09:52 UTC 2006
Hi all,
I'm having issues with using :void as a type in certain places. I'm trying to wrap the following in CFFI:
struct _xmlAttribute {
void *_private; /* application data */
xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
const xmlChar *name; /* Attribute name */
struct _xmlNode *children; /* NULL */
struct _xmlNode *last; /* NULL */
struct _xmlDtd *parent; /* -> DTD */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
struct _xmlAttribute *nexth; /* next in hash table */
xmlAttributeType atype; /* The attribute type */
xmlAttributeDefault def; /* the default */
const xmlChar *defaultValue; /* or the default value */
xmlEnumerationPtr tree; /* or the enumeration tree if any */
const xmlChar *prefix; /* the namespace prefix if any */
const xmlChar *elem; /* Element holding the attribute */
};
-----------------------------------------------
SWIG for CFFI produced:
(defcstruct _xmlAttribute
(_private :void)
(type :pointer)
(name :unsigned-char)
(children :pointer)
(last :pointer)
(parent :pointer)
(next :pointer)
(prev :pointer)
(doc :pointer)
(nexth :pointer)
(atype :pointer)
(def :pointer)
(defaultValue :unsigned-char)
(tree :pointer)
(prefix :unsigned-char)
(elem :unsigned-char))
-----------------------------------------------
And SBCL 0.9.7 produced:
cannot use values types here
[Condition of type SIMPLE-ERROR]
Restarts:
0: [RETRY] Retry performing #<ASDF:COMPILE-OP NIL {92EA579}> on #<ASDF:CL-SOURCE-FILE "libxml2" {92E6E89}>.
1: [ACCEPT] Continue, treating #<ASDF:COMPILE-OP NIL {92EA579}> on #<ASDF:CL-SOURCE-FILE "libxml2" {92E6E89}>
as having been successful.
2: [ABORT] Abort SLIME compilation.
3: [ABORT-REQUEST] Abort handling SLIME request.
4: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {91B5D81}>)
Backtrace:
0: (SB-ALIEN::ALIEN-VALUES-TYPE-TRANSLATOR (VALUES) #<NULL-LEXENV>)
1: (CFFI-SYS:%FOREIGN-TYPE-ALIGNMENT :VOID)
2: (CFFI::ADJUST-FOR-ALIGNMENT :VOID 0 :NORMAL T)
3: (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION CL-LIBXML2::_XMLATTRIBUTE ((CL-LIBXML2::_PRIVATE :VOID) (TYPE
:POINTER) (CL-LIBXML2::NAME :UNSIGNED-CHAR) (CL-LIBXML2::CHILDREN :POINTER) (LAST :POINTER) (CL-LIBXML2::PARENT
:POIN$ 4: (SB-INT:EVAL-IN-LEXENV (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION (QUOTE CL-LIBXML2::_XMLATTRIBUTE)
(QUOTE (# # # # # # # # # # ...))) #<NULL-LEXENV>)
5: ((FLET SB-C::DEFAULT-PROCESSOR) (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION (QUOTE CL-LIBXML2::_XMLATTRIBUTE)
(QUOTE (# # # # # # # # # # ...))))
6: (SB-C::PROCESS-TOPLEVEL-FORM (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION (QUOTE CL-LIBXML2::_XMLATTRIBUTE)
(QUOTE (# # # # # # # # # # ...))) ((EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
(CFFI::NOTICE-FOREIGN-STR$ 7: (SB-C::PROCESS-TOPLEVEL-PROGN ((CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION (QUOTE
CL-LIBXML2::_XMLATTRIBUTE) (QUOTE #))) ((EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
(CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION # #)) $ 8: (SB-C::PROCESS-TOPLEVEL-FORM (EVAL-WHEN (:COMPILE-TOPLEVEL
:LOAD-TOPLEVEL :EXECUTE) (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION (QUOTE CL-LIBXML2::_XMLATTRIBUTE) (QUOTE #)))
(SB-C::ORIGINAL-SOURCE-START 0 46) NIL)
9: ((FLET SB-C::DEFAULT-PROCESSOR) (CFFI:DEFCSTRUCT CL-LIBXML2::_XMLATTRIBUTE (CL-LIBXML2::_PRIVATE :VOID)
(TYPE :POINTER) (CL-LIBXML2::NAME :UNSIGNED-CHAR) (CL-LIBXML2::CHILDREN :POINTER) (LAST :POINTER)
(CL-LIBXML2::PARE$ 10: (SB-C::PROCESS-TOPLEVEL-FORM (CFFI:DEFCSTRUCT CL-LIBXML2::_XMLATTRIBUTE
(CL-LIBXML2::_PRIVATE :VOID) (TYPE :POINTER) (CL-LIBXML2::NAME :UNSIGNED-CHAR) (CL-LIBXML2::CHILDREN :POINTER)
(LAST :POINTER) (CL-LIBXML2::PARENT $ 11: (SB-C::SUB-SUB-COMPILE-FILE #<SB-C::SOURCE-INFO >)
12: ((LAMBDA NIL))
13: (SB-C::%WITH-COMPILATION-UNIT #<CLOSURE (LAMBDA NIL) {934352D}>)
14: (SB-C::SUB-COMPILE-FILE #<SB-C::SOURCE-INFO >)
15: (COMPILE-FILE #P"/home/brad/dev/lisp/cl-libxml2/src/libxml2.lisp")
16: ((SB-PCL::FAST-METHOD ASDF:PERFORM (ASDF:COMPILE-OP ASDF:CL-SOURCE-FILE)) #<unavailable argument>
#<unavailable argument> #<ASDF:COMPILE-OP NIL {92EA579}> #<ASDF:CL-SOURCE-FILE "libxml2" {92E6E89}>)
17: ((LAMBDA (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-PCL::.ARG1.)) #<unavailable
argument> #<unavailable argument> #<ASDF:COMPILE-OP NIL {92EA579}> #<ASDF:CL-SOURCE-FILE "libxml2" {92E6E89}>)
18: ((LAMBDA NIL))
19: (SB-C::%WITH-COMPILATION-UNIT #<CLOSURE (LAMBDA NIL) {932F0CD}>)
Thoughts?
Thanks,
Brad
More information about the cffi-devel
mailing list