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. :)
On 19/set/2005, at 18:15, Kenny Tilton wrote:
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. :)
You can generate a pointer to a given address by using:
(inc-ptr (null-ptr) <address>)
Which is a bit silly. I guess I'll add a new CFFI-SYS primitive:
MAKE-PTR address
And well, why not, PTR-ADDRESS to get the address of the pointer.