Debugging a Callback

James Ashley james.ashley at gmail.com
Thu Jun 20 01:09:27 UTC 2013


Luís Oliveira <luismbo <at> gmail.com> writes:

> 
> James Ashley <james.ashley <at> gmail.com> writes:
> 
> 
> > The value 17465867632912 is not of the expected type DOUBLE-FLOAT.
> 
> [...]
> 
> >         COMMON-LISP:RATIO = 649/502
> >         CL-OPENGL-BINDINGS::LEFT = -649/502
> 
> [...]
> 
> 
> The stack trace is not being very helpful, no. GL:ORTHO tries to coerce
> each of its arguments into doubles via (float x 1.0d0). Maybe
> something's going wrong in that process? There's also inlining going on,
> as the GL:ORTHO is defined via %GL:DEFGLFUN which might not get
> triggered when you try it out from the REPL.
> 
> So, I'd try to (1) convert the ratio to double before passing it to
> GL:ORTHO and maybe the other arguments as well, (2) call glOrtho() using
> plain CFFI:FOREIGN-FUNCALL,

The combination of these two fixes my immediate problem. Thank you!



> (3) use CCL:EXTERNAL-CALL. You can quickly
> figure out how to get the appropriate CCL:EXTERNAL-CALL form by
> macroexpansing CFFI:FOREIGN-FUNCALL.

This also works fine (as it should, based on the previous 2 steps...thank
you, again).

So...what does that imply for what I should take-away on this?

The original version seems to work fine on SBCL. cl-opengl doesn't claim to
run on CCL. I haven't had a chance to try it on different platforms to even
begin getting a clue about whether it's isolated that way (though 64-bit
linux can't be a common target platform).

I'm inclined to suspect that the actual problem lies in CCL, but it seems
like it could also just relate to ambiguity in interpreting the spec. So
maybe it really is more just a matter of lee-way in cl-opengl's defglfun.

Sorry. Now I'm probably just babbling, being stupid, and wasting bandwidth.
I'd like to volunteer what little help I have to offer to help fix the
actual problem, but this probably isn't the forum.
 
> HTH,
> 

Thanks again,
James






More information about the cffi-devel mailing list