cl-gtk2 on Windows

I've managed to run cl-gtk2 on Windows but first I had to fix some issues.

A simple issue was that some Gtk+ libraries were defined wrongly (some of them had the wrong file names).

A more complicated issue is that the CFFI was optimizing calls to the foreign-funcall function with a constant argument which I believe is not entirely correct. And the Windows port of SBCL tried to link in the called function at compile time event if the call would have never actually happened. At least the CFFI developers hadn't applied such an optimization on the expression such as (foreign-funcall-pointer (foreign-symbol-pointer ...) ...).

The current version of cl-gtk2 only works with quite a recent version of Gtk+-2.16. It's available at http://www.gtk.org/download-windows.html. After unpacking the libraries, the path to the gtk/bin directory should be added to the PATH environment variable in order for CFFI to find the libraries. Or it's possible to add the path to the gtk/bin directory into CFFI:*FOREIGN-LIBRARY-DEFINITIONS* dynamic variable. For GtkGlExt to work, you should install:

To my surprise, it worked almost without a hitch. Even the OpenGL teapot from GLUT worked via GtkGlExt.

But, unfortunately, due to reasons yet unknown, when running cl-gtk2 from under SLIME, the (gtk-main) function call causes SBCL to hang. I guess maybe SWANK does something with file handles or sockets that plays badly with Gtk+'s event loop.