I struggled over the weekend to get Chicken Scheme to call some X and OpenGL libraries. The problem I was having was my program would hang for no apparent reason. After much debugging I tracked it down to the garbage collecting infinitely looping through minor garbage collections.
I should have followed my Corman Lisp advice posted previously...look to your code not the implementation.
I was using SWIG to automatically generate wrappers to the C code but there is a caveat. Chicken requires special code if the C code you are calling calls back into C. I use scheme callbacks to implement drawing routines, etc for windows. SWIG doesn't generate this special code as it doesn't know what what call back into Scheme and what won't. The fix was to write my own wrapper for that specific function using FOREIGN-CALLBACK-LAMBDA: (define wrapper-do-event
(foreign-callback-lambda void "do_event" c_pointer))
And now I have multiple OpenGL windows displaying and changable from the Chicken Scheme read-eval-print loop interactively. Neat.
2:26:42 AM
|