From j_p at aleph0.info Sat Feb 7 17:24:14 2009 From: j_p at aleph0.info (Jeronimo Pellegrini) Date: Sat, 7 Feb 2009 15:24:14 -0200 Subject: [fetter-devel] "Don't know how to write # ..."? Message-ID: <20090207172414.GA8631@localhost> Hello, I am trying to generate bindings for lp-solve [0], which is a plain C library. After installing Verrazano I tried to generate the bindings: $ sbcl * (asdf:operate 'asdf:load-op 'verrazano) ... * (in-package :verrazano-user) # * (generate-binding (append (list :cffi :package-name :lpsolve-cffi-bindings :input-files '("lpsolve/lp_lib.h")))) $ gccxml --version ; Standard output: GCC-XML version 0.9.0 $ gccxml -fxml="//tmp/990vzntemp.xml" "//tmp/990vzntemp.cpp" $ gccxml --preprocess -dDI "//tmp/990vzntemp.cpp" >"//tmp/990vzntemp.mac" debugger invoked on a COMMON-LISP:SIMPLE-ERROR in thread #: Don't know how to write # {100588EEC1}> as a CFFI type Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level. ((SB-PCL::FAST-METHOD VERRAZANO::WRITE-CFFI-TYPE (COMMON-LISP:T)) # # # {100588EEC1}>) Also, following the instructions in the README dile, I ran sbcl --load generate-example-bindings.lisp Some examples didn't work because I don't have the headers installed (OK, fine); one example ran successfully (OpenGL); but cairo, for example, failed for some other reason: ; *** Processing binding :CAIRO-CFFI-BINDINGS $ gccxml --version ; Standard output: GCC-XML version 0.9.0 $ gccxml `pkg-config --cflags cairo` -fxml="//tmp/167vzntemp.xml" "//tmp/167vzntemp.cpp" $ gccxml `pkg-config --cflags cairo` --preprocess -dDI "//tmp/167vzntemp.cpp" >"//tmp/167vzntemp.mac" COMMON-LISP:WARNING: Failed to generated binding for :CAIRO-CFFI-BINDINGS, error: The function VERRAZANO::FIRST-TIME-P is undefined. I do have all Cairo headers in /usr/include/cairo... I don't know what FIRST-TIME-P means, but it seems to be a different problem from what prevented the generation of lp-solve bindings. I am using SBCL 1.0.25.10, and Verrazano just checked out from darcs (latest commit Fri Aug 8 05:41:47 BRT 2008), So... What could I be doing wrong here? Thank you! [0] http://tech.groups.yahoo.com/group/lp_solve/ http://lpsolve.sourceforge.net/5.5/ In Debian it is the lp-solve package. From attila.lendvai at gmail.com Sat Feb 7 17:48:22 2009 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Sat, 7 Feb 2009 18:48:22 +0100 Subject: [fetter-devel] "Don't know how to write # ..."? In-Reply-To: <20090207172414.GA8631@localhost> References: <20090207172414.GA8631@localhost> Message-ID: > Failed to generated binding for :CAIRO-CFFI-BINDINGS, error: The function VERRAZANO::FIRST-TIME-P is undefined. my guess is that your iterate package is too old. darcs get the latest. > So... What could I be doing wrong here? nothing, probably there's something in your headers that we didn't meet while writing the relevant parts. i personally have zero time for this, so try yo come up with the required patch. it's really easy, just look at the other emitters in backends/cffi/writers.lisp hth, -- attila From j_p at aleph0.info Sun Feb 8 02:45:02 2009 From: j_p at aleph0.info (Jeronimo Pellegrini) Date: Sun, 8 Feb 2009 00:45:02 -0200 Subject: [fetter-devel] "Don't know how to write # ..."? In-Reply-To: References: <20090207172414.GA8631@localhost> Message-ID: <20090208024502.GA25799@localhost> On Sat, Feb 07, 2009 at 06:48:22PM +0100, Attila Lendvai wrote: > nothing, probably there's something in your headers that we didn't > meet while writing the relevant parts. i personally have zero time for > this, so try yo come up with the required patch. it's really easy, > just look at the other emitters in backends/cffi/writers.lisp I found the problem... #if (defined _WIN32) || (defined WIN32) || (defined _WIN64) || (defined WIN64) # define __WINAPI WINAPI #else # define __WINAPI #endif ... /* typedef for pointer to function: */ typedef int (__WINAPI lphandle_intfunc)(lprec *lp, void *userhandle); Since I'm not running Windows, __WINAPI is still defined, but some of the types are messed up, it seems. Anyway, that's for dynamic loading thelibrary, which I don't need. I'll make Vzn print :UNKNOWN (cffi::defctype lphandle-intfunc :UNKNOWN ) And then just run the result through some filter, deleting those entries. (But I don't have a real solution to the problem, unfortunately) Anyway, thanks for pointing me to the backend writer. J.