[cffi-devel] Bus error ... ?! Help, please ...

Frank Goenninger frgo at me.com
Fri May 8 12:48:50 UTC 2009


Hi all:

While resurrecting Kenny Tilton's Cello and trying to reuse some code  
of the cl-opengl bindings (trying to unite the two) I came across this  
error:

Source:

(define-foreign-library OpenGL
   (:darwin (:framework "OpenGL"))
   (:windows "opengl32.dll" :calling-convention :stdcall)
   (:unix (:or "libGL.so" "libGL.so.2" "libGL.so.1")))

(use-foreign-library OpenGL)

(define-foreign-library GLU
   (:windows "glu32.dll")
   ((:and :unix (:not :darwin)) (:or "libGLU.so.1" "libGLU.so"))
   ((:not :darwin) (:default "libGLU")))

(use-foreign-library GLU)

(defconstant GL_VERSION #x1f02)
(defctype GLenum :unsigned-int)

(defmacro defglfun ((cname lname) result-type &body body)
   `(progn
      (declaim (inline ,lname))
      (defcfun (,cname ,lname :library OpenGL) ,result-type , at body)))

(defglfun ("glGetString" %glGetString) :pointer
   (name GLenum))

(defun gl-get-version ()
   (let ((version-string (%glGetString GL_VERSION))) ;; <<<<---- BUS  
ERROR !
     (break)
     (foreign-string-to-lisp version-string)))

REPL:

;   Foreign loading /System/Library/Frameworks/OpenGL.framework/OpenGL.
CL-USER > (gl-get-version)
Bus Error (Signal 10)

Oh, btw, that happens no matter what function from OpenGL I try to  
call... So, something very fundamental must be wrong here. I just  
can't see what ... Please help!

TIA!!!!

Best,
    Frank





More information about the cffi-devel mailing list