[cl-opengl-devel] Extension functions re-defining themselves
Luís Oliveira
luismbo at gmail.com
Sat Mar 31 15:42:00 UTC 2012
Hello Jocelyn,
I tried it out as well and got similar results. I also tried using
load-time-value for the pointer cache in the hopes that making the DEFUN a
top-level form would appease SBCL but that help too much.
Have you tried using a less smart compiler such as CCL ou CLISP?
--
Luís Oliveira
http://r42.eu/~luis
On Mar 17, 2012 11:28 AM, "Jocelyn Fréchot" <jocelyn_frechot at yahoo.fr>
wrote:
> On 17/03/2012 11:01, Luís Oliveira wrote:
>
> At the end of gl/bindings.lisp there's an alternative implementation
>> of DEFGLEXTFUN that doesn't call compile or redefine anything. Does
>> that work better for you?
>>
>
> I tried this version:
>
> (defmacro defglextfun ((cname lname) return-type &body args)
> (alexandria:with-unique-names (pointer)
> `(let ((,pointer (null-pointer)))
> (defun ,lname ,(mapcar #'car args)
> (when (null-pointer-p ,pointer)
> (setf ,pointer (gl-get-proc-address ,cname))
> (assert (not (null-pointer-p ,pointer)) ()
> "Couldn't load symbol ~A~%" ,cname)
> (format t "Loaded function pointer for ~A: ~A~%" ,cname ,pointer)
> (push (lambda () (setf ,pointer (null-pointer)))
> *gl-extension-resetter-list*))
> (foreign-funcall-pointer
> ,pointer
> (:library opengl)
> ,@(loop for arg in args collect (second arg) collect (first arg))
> ,return-type)))))
>
> However, compilation of gl/funcs.lisp fails due to heap exhaustion
> (using SBCL 1.0.55).
>
> --
> Jocelyn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-opengl-devel/attachments/20120331/be8e5a09/attachment.html>
More information about the cl-opengl-devel
mailing list