[fetter-devel] Verrazano and ncurses

Rayiner Hashem rayiner at gmail.com
Wed Dec 7 01:21:30 UTC 2005


> Sounds like a hard problem - a char * can be a byte pointer or a null
> terminated string.  It guess that maybe a good way to do it would be
> to allow the user to specify in the generation file a default
> behaviour and allow per function overrides.  For example, in ncurses
> char * is always a string.

That's an idea. I wonder how many other libraries have predictable
behavior like this...

>
> Cheers
> Brad
>
> generate.lisp
> (require 'asdf)
> (asdf:operate 'asdf:load-op 'verrazano)
>
> (verrazano:create-binding
>   (verrazano:setup-build "gccxml"
>                          (make-pathname :device "/" :directory "/tmp"))
>   "test.binding"
>   "test-library.lisp"
>   :cffi-backend)
> (quit)
>
> test.bindings
> (defbinding "test-library"
>     (include "/home/brad/development/lisp/bindings/test/test.h"))
>
> test.h
> int main (int i);
>
> ---- Error Trace ----
> ; compiling file
> "/home/brad/development/lisp/packages/verrazano-support/support.lisp"
> (written 05 DEC 2005 10:29:57 PM):
> ; compiling (DEFPACKAGE "VERRAZANO-SUPPORT" ...)
> ; compiling (IN-PACKAGE "VERRAZANO-SUPPORT")
> ; compiling (DEFUN VTABLE-LOOKUP ...)
> ; file: /home/brad/development/lisp/packages/verrazano-support/support.lisp
> ; in: DEFUN VTABLE-LOOKUP
> ;     ((TEST-LIBRARY::VPTR
> ;     (CFFI:MEM-REF TEST-LIBRARY::POBJ :POINTER TEST-LIBRARY::COFF)))
> ;
> ; caught COMMON-LISP:ERROR:
> ;   illegal function call
>
> ;     (CFFI:MEM-AREF TEST-LIBRARY::VPTR
> ;                  :POINTER
> ;                  (TEST-LIBRARY::- TEST-LIBRARY::INDX 2))
> ; --> CFFI:MEM-REF CFFI-SYS:%MEM-REF SB-SYS:SAP-REF-SAP
> ; ==>
> ;   TEST-LIBRARY::VPTR
> ;
> ; note: deleting unreachable code
>
> ; compiling (DEFMACRO VIRTUAL-FUNCALL ...)

Oh, I think I understand the problem. I'll take a look at that when I
get home (tomorrow :-/). You're on SBCL, right? Try commenting out the
line "(asdf:operate 'asdf:load-op 'verrazano-support" in the generated
library file. Does that fix the issue?

Sincerely,
    Rayiner Hashem



More information about the fetter-devel mailing list