[slime-devel] Re: Slime hanging on foreign function calls with Lispworks

Glenn Ehrlich glenn.ehrlich at specastro.com
Tue Jul 5 19:40:02 UTC 2005


Glenn Ehrlich <glenn.ehrlich <at> specastro.com> writes:

> 
> Edi Weitz <edi <at> agharta.de> writes:
> 
> > 
> > On Wed, 29 Jun 2005 13:02:09 -0400, "Shawn Nicholson" <shawn.nicholson <at>
> dnamerican.com> wrote:
> > 
> > >   My question can be disregarded.  I see in the known problems
> > > document that this issue does not currently have a known reason or
> > > solution.
> > 
> > You might also want to search Gmane for a thread called "Problems with
> > LWW FFI" or something like that.  Martin Simmons there describes what
> > he thinks is the underlying problem.  No solution yet, though...
> > 
> > Cheers,
> > Edi.
> > 
> 
> This is really weird.  Before the July 3 CVS, SLIME hanged for me when calling
> FFI (using LispWorks 4.4.5 Personal Edition), but with the July 3 CVS, I can
> call foreign functions just fine from SLIME.  This is with a DLL that was
> built
> with MS Visual C++ version 6.0 and MinGW, both built with default options, and
> not doing anything different than I had before.
> 
> I'd like to see this stay fixed :)
> 
> 


Edi asked me to try out the test.dll that appeared in this post:

<http://article.gmane.org/gmane.lisp.slime.devel/2912>

so I downloaded <http://zappa.agharta.de/test.dll> to a working directory, ,cd
in the slime repl to that directory and did this:

CL-USER> (fli:register-module "test.dll")
"test.dll"
CL-USER> (fli:define-foreign-function foo
	     ((x :int))
	   :result-type :int)
FOO
CL-USER> (foo 21)
42

So, the particulars are:

Windows 2000, SP4
"GNU Emacs 21.3.1 (i386-mingw-nt5.0.2195) of 2004-03-10 on NYAUMO"
(the standard download from fsf)
SLIME 2005-07-03
LispWorks 4.4.5 Personal Edition

Just checked on a cleaned out version of SLIME 2005-06-21 and test.dll also
works.

In other messages in the same thread, doing:
(capi:display-message "foo")
is supposed to hang in a fresh SLIME as well, and for me, I get the message box.

I thought it might be because I called fli:register-module "test.dll"), but
here's a fresh slime where I don't (I'm in some other directory other than
c:/home/glenn):

; SLIME 2005-06-21
CL-USER> (fli:define-foreign-function foo
	     ((x :int))
	   :result-type :int
	   :module "c:/home/glenn/test.dll")
FOO
CL-USER> (foo 21)
42
CL-USER> 

Just to be totally tedious, here's all of my slime related setup:

(require 'slime)
(slime-setup :autodoc t)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
(define-key slime-mode-map [(control c) (control backspace)] 'cltl2-lookup)
(setq common-lisp-hyperspec-root "file:///usr/local/doc/HyperSpec/")
(define-key slime-mode-map [(control c) (s)] 'slime-selector)

(defun go-slime-lispworks ()
  (interactive)
  (shell-command (expand-file-name "~/bin/start_lispworks.vbs"))
  (slime-connect "127.0.0.1" 4005))

I start up emacs, M-x go-slime-lispworks, which starts up lispworks via this VB
script:

Dim Wsh
Set Wsh = WScript.CreateObject("WScript.Shell")

rem Start LispWorks
Wsh.Run("c:\lispworks\lispworks-personal-4450.exe")

rem Wait for a few seconds for it to start
WScript.Sleep(5000)

rem Press the OK button on the splash screen
Wsh.AppActivate "Upgrade LispWorks"
Wsh.SendKeys "{ENTER}"

rem Load the SLIME startup code
rem Wsh.AppActivate "LispWorks Personal Edition 4.4.5"
Wsh.AppActivate "Listener 1"
str = "load " & """c:/home/glenn/bin/slime.lisp"""
WScript.Sleep(100)
Wsh.SendKeys (str)
Wsh.SendKeys "{ENTER}"
WScript.Sleep(1000)

rem Toggle back to Emacs
rem Wsh.SendKeys "%{TAB}"

The above script calls my ~/bin/slime.lisp:

(load "/usr/local/share/emacs/slime/swank-loader.lisp")
(swank::create-swank-server 4005 :spawn #'swank::simple-announce-function t)
(load "/usr/local/share/emacs/slime/present")
(load "/home/glenn/.lispworks")

The .lispworks just does a bunch of asdf stuff and sets the compiler options.

Other than I was getting the hanging just last week, I can't explain why it's
all of sudden working with 2 recent versions of slime.

Just another check, I was wondering if anything I was loading via asdf from my
.lispworks was helping out, so I started a fresh LispWorks (not via my VB
script), manually started up swank (just the 2 lines above, I didn't load
present.lisp or my .lispworks).  Then I did a slime-connect, and I still got a
successful result.

For the life of me, I can't make it break at the moment.

Hope some of this might help.

Glenn





More information about the slime-devel mailing list