On Mon, Dec 21, 2009 at 4:52 PM, Elliott Slaughter <elliottslaughter@gmail.com> wrote:
On Mon, Dec 21, 2009 at 1:26 PM, Luís Oliveira <luismbo@gmail.com> wrote:
On Mon, Dec 21, 2009 at 8:55 PM, Elliott Slaughter
<elliottslaughter@gmail.com> wrote:
> I'm believe I'm seeing this issue again, but none of my previous workarounds
> seem to be working. I am using SBCL 1.0.29 on Windows XP, and when I save
> and run an executable, I keep getting undefined alien errors. I have tried
> both the :dont-save t hack that I initially suggested, and have tried
> calling (close-foreign-library ...) on all of the open libraries before
> saving the executable, and nothing helps.

Can you come up with a minimal test case? Something using e.g.
libtest.dll would be nice.

Sure.

For this test, I used SDL.dll from http://www.libsdl.org/release/SDL-1.2.14-win32.zip .

$ cat test.lisp
(asdf:oos 'asdf:load-op :cffi)
(cffi:define-foreign-library sdl
  (:windows "SDL.dll"))
(cffi:use-foreign-library sdl)
(cffi:defcfun ("SDL_Linked_Version" SDL-Linked-Version) :pointer)
(defun main () (format t "does it work?~%") (quit))
(cffi:close-foreign-library 'sdl)
(save-lisp-and-die #+windows "main.exe" #-windows "main"
                   :toplevel #'main :executable t)

After what feels like beating my head against a wall for several hours, and getting contradictory results from various attempts to boils the failure down to a manageable size, I finally tried my original build recipe again, and it just worked. I'm not really sure what to say, other than that I'm really confused. I don't think the workarounds suggested by myself and others are necessary, so I think we can all forget about this, at least until this comes to haunt me again.

Sorry about the noise.
 
--
Elliott Slaughter

"Don't worry about what anybody else is going to do. The best way to predict the future is to invent it." - Alan Kay