Re: [Sbcl-help] Problem using CFFI on OS X

In article <22ED1232-689E-4F7A-96C3-43415F50F3DF@...>,
Martin Buchmann <martin.buchmann@...> wrote:
> I started
> with the libcurl tutorial[1] but if I use the sample code directly in the
> slime-repl buffer the statement (use-foreign-library libcurl) leads to an
> unexpected connection breake down.
>
> Lisp connection closed unexpectedly: connection broken by remote peer
>
> If I invoke the example code directly in sbcl running in a terminal it is
> working fine so far.
OS X has several libraries (particularly system ones) that can only be
loaded (and sometimes executed) from the main thread. There used to be
tricks to trick OS X into thinking another thread is the main thread,
but they don't work in the post 10.6 world. On SBCL, as you discovered,
the main thread is the REPL thread (inferior-lisp in SLIME).
Paul Khuong

Thread view

Hi all,
I wanted to play around with cffi recently on my system (sbcl 1.0.51 on OS X 10.6.8, Aquamacs 2.2, Slime installed via quicklisp from 20110829). I started with the libcurl tutorial[1] but if I use the sample code directly in the slime-repl buffer the statement (use-foreign-library libcurl) leads to an unexpected connection breake down.
Lisp connection closed unexpectedly: connection broken by remote peer
If I invoke the example code directly in sbcl running in a terminal it is working fine so far. As I never had to deal with something like this before, I do not know how to proceed. Could anyone give me a hint how to get more information or even better how to fix this :-)
Thanks in advance
Martin
<--- sample code --->
(asdf:oos 'asdf:load-op :cffi)
;;; Nothing special about the "CFFI-USER" package. We're just
;;; using it as a substitute for your own CL package.
(defpackage :cffi-user
(:use :common-lisp :cffi))
(in-package :cffi-user)
(define-foreign-library libcurl (t "libcurl.dylib"))
(use-foreign-library libcurl)
<--- end of sample code --->
[1] http://common-lisp.net/project/cffi/manual/html_node/Tutorial_002dGetting-a-URL.html#Tutorial_002dGetting-a-URL

In article <22ED1232-689E-4F7A-96C3-43415F50F3DF@...>,
Martin Buchmann <martin.buchmann@...> wrote:
> I started
> with the libcurl tutorial[1] but if I use the sample code directly in the
> slime-repl buffer the statement (use-foreign-library libcurl) leads to an
> unexpected connection breake down.
>
> Lisp connection closed unexpectedly: connection broken by remote peer
>
> If I invoke the example code directly in sbcl running in a terminal it is
> working fine so far.
OS X has several libraries (particularly system ones) that can only be
loaded (and sometimes executed) from the main thread. There used to be
tricks to trick OS X into thinking another thread is the main thread,
but they don't work in the post 10.6 world. On SBCL, as you discovered,
the main thread is the REPL thread (inferior-lisp in SLIME).
Paul Khuong