[cffi-devel] Interesting problem passing faux pointers

Kenny Tilton ktilton at nyc.rr.com
Mon Sep 19 17:15:50 UTC 2005


Background
========
The OpenGL Glut utility has an oddity. Font utilities such as 
glutStrokeChar take as their first argument a pointer. The oddity is 
that on X11 an actual pointer to font info is expected, but on win32 an 
enum is expected. The enum indicates which of a half dozen built-in 
fonts  to use. So on win32  I need to pass something like  0 or 1 as a 
pointer.


Under UFFI, for ACL and LW I was forced to make a special pointer object 
to pass thru the FFI. Here is the Lispworks code:

(defun enum-to-pointer (enum)
   (fli:make-pointer :address enum :pointer-type  '(:pointer :void)))

There was something similar for ACL.

Problem: with CFFI, I could (and had to) eliminate the ACL wrapping. But 
Lispworks still needs it, and I just ran into what looks like the same 
thing from CLisp.

Is this oddity something that is not covered by the test suite? Or did I 
miss some new CFFI make-pointer? The CFFI reference chapter on pointers 
is a little sparse. :)

-- 
Kenny

Why Lisp? http://wiki.alu.org/RtL_Highlight_Film

"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