[cffi-devel] various

Kenny Tilton ktilton at nyc.rr.com
Wed Sep 7 15:55:12 UTC 2005


0. My OpenAL demo now works fine. The segmentation fault was because I 
was passing a Lisp rational where a float was needed. My poor-man's 
version of VZN generated wrappers which coerced all arguments before 
calling the true C binding. A quick glance at the CFFI defcfun expansion 
suggests automatic conversion is being done there, as well. What am I 
missing? Does the mechanism not attempt converting rationals to floats?

1. I think VZN should export all symbols. It was a total pain doing 
those manually. Besides, C does not do exported vs. imported, so trying 
not to export all symbols is an "extra". And the cost of that extra is 
the aggravation of having to manually cobble together all the symbols to 
be exported.

2. The latest VZN gens two warnings:

; While compiling (METHOD CHECK-AND-MARK-ARTIFICIAL (T)) in 
C:\0devtools\verrazano\frontend\simplifier.lisp:
Warning: Variable NODE-OR-EDGE is never used.

; While compiling (METHOD GENERATE-PACKAGE ((EQL :CFFI-BACKEND) T T)) in 
C:\0devtools\verrazano\cffi-backend\generator.lisp:
Warning: variable BK is used yet it was declared ignored

3. (CFFI) As advertised in earlier epistles, these are coming from 
somewhere:

; While compiling (:TOP-LEVEL-FORM "openal-library.lisp" 2333) in 
C:\0dev\cl-openal\openal-library.lisp:
Warning: :call-direct ignored; no argument types specified.
; While compiling (:TOP-LEVEL-FORM "openal-library.lisp" 2333) in 
C:\0dev\cl-openal\openal-library.lisp:
Warning: :call-direct ignored; no argument types specified.
; While compiling (:TOP-LEVEL-FORM "openal-library.lisp" 2333) in 
C:\0dev\cl-openal\openal-library.lisp:
Warning: :call-direct ignored; no argument types specified.

This is AllegroCL. Looks like CFFI needs to avoid inserting the 
:call-direct in some cases. Let me know if you need the actual code and 
I will try to figure out which are squawking.

4. (VZN) al.h or someone has: #define AL_FALSE 0 and #define AL_NO_ERROR 
AL_FALSE. The second define does not make it into the bindings because 
it does not look like a numeric constant. I can add it to the generated 
bindings manually, but then I have to do it every time I regen the 
bindings. Would it make sense to allow users to provide code in the 
defbinding form which will get blindly copied into the output?:

(defbinding "openal-library"
    (nicknames "al")
  (flags "")
  (include
    "AL/al.h"
   "AL/alc.h"
    "AL/alut.h")
  (export "alenable"
    "aldisable")
  (export....)
  (override "")
    (append
       (defparameter +al-no-error+ 0)))

Btw, why not defconstant when translating #defines?

Anyway, congrats to all on the first "live" set of bindings.

-- 
Kenny

Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film

"I've wrestled with reality for 35 years, Doctor, and I'm happy to state I finally won out over it."
    Elwood P. Dowd, "Harvey", 1950






More information about the cffi-devel mailing list