Hello,
I have been having trouble with a bug that seems to only occur when running from SLIME, as opposed to the REPL at a CMD prompt. Basically, when I try to run a windowed application, it will hang when opening the window. I do not have any idea why. For example, the following sequence will hang:
(ql:quickload "sdl2-examples") (sdl2-examples:basic-test)
When trying to debug it further, I found an odd workaround, though. I noticed CCL had some basic win32 samples. In trying to isolate the issue, I ran the following:
(defun hack-fix-slime-window () (load "c:/Users/MickBeaver/private/software_packages/ccl/examples/mswin.lisp") (make-simple-ms-window))
That opens a basic win32 window. Afterward, my other windowed applications will start working as expected. So strange! I do not have any issues running from the CMD prompt REPL, though. According to CCL's mswin.lisp, I do not believe I was the first person to encounter this:
<snip-start> ;;; At the moment, attempts to create a window when running under SLIME ;;; fail for unknown reasons.<snip-end>
Any ideas?
System info: GNU Emacs 24.3.1 SLIME 2014-03-27 Microsoft Windows 7 x64 Professional and Microsoft Windows 8 x64 Tried both Clozure Common Lisp 1.9 64-bit and SBCL 1.1.17 64-bit
-Mick
On Fri, Jun 6, 2014 at 10:47 PM, Mick Charles Beaver m.charles.beaver@gmail.com wrote:
I have been having trouble with a bug that seems to only occur when running from SLIME, as opposed to the REPL at a CMD prompt. Basically, when I try to run a windowed application, it will hang when opening the window. I do not have any idea why.
It might have something to do with the fact that SLIME's REPL does not run in the initial thread. Perhaps you could try and execute your windowing code in the initial thread?
HTH,
I finally have this issue figured out. The problem lies in an MS Windows and GNU Emacs interaction. I debugged this further today by attaching to a debug version of the SDL2 DLL. You could imagine my surprise when I found that my OpenGL application was actually running as expected, but was just not visible. Running fullscreen worked as expected.
As I tried to narrow down what was going wrong with showing the window. This led me back to http://svn.clozure.com/publicsvn/openmcl/release/1.9/source/examples/mswin.l... and to this comment:
"Depending on how the lisp process was created, the first call to #_ShowWindow in that process might ignore its argument (and instead use an argument specified in the STARTUPINFO structure passed to #_CreateProcess.) SLIME under FSF Emacs runs the lisp with this flag set, and it's possible to waste a week or two trying to track this down. (Trust me.)"
Sure enough, CreateProcess() and ShowWindow() have that odd interaction where the first call to ShowWindow() is ignored depending on the STARTUPINFO passed to CreateProcess(). SERENITY NOW!!!
While there are a few different ways to solve this issue. The most palatable to me is to just call ShowWindow() twice when running in SLIME. I see that there is a w32-start-process-show-window variable and a way to identify a subprocess as a GUI app. This may or may not be appropriate for the inferior lisp process. I suspect that it would show the command prompt window as well as the GUI window.
-Mick
On Sun, Jun 8, 2014 at 10:38 AM, Luís Oliveira luismbo@gmail.com wrote:
On Fri, Jun 6, 2014 at 10:47 PM, Mick Charles Beaver m.charles.beaver@gmail.com wrote:
I have been having trouble with a bug that seems to only occur when
running from SLIME, as opposed to the REPL at a CMD prompt. Basically, when I try to run a windowed application, it will hang when opening the window. I do not have any idea why.
It might have something to do with the fact that SLIME's REPL does not run in the initial thread. Perhaps you could try and execute your windowing code in the initial thread?
HTH,
-- Luís Oliveira http://kerno.org/~luis/