From: Nikodemus S. <nik...@ra...> - 2008-03-03 10:49:57
|
On 3/3/08, Liam Healy <ln...@he...> wrote: > I have written a package (GSLL) that is basically an interface to a > foreign library. > I define a condition 'gsl-error that can be signaled by the library in > a callback. This works > fine except when the GSLL image is saved in a save-lisp-and-die; then > it just hangs. > Any suggestions on how to make this work? First, check if the callback works at all in the saved image by calling it directly from Lisp: (in-package :cl-user) (alien-funcall (sap-alien (cffi-sys:%callback 'gsl-error) (function void system-area-pointer system-area-pointer int int)) ...arguments...) If that works as expected (it should), then my guess is that the library uses some sort of initialization / deinitialization scheme, and needs to be set up again when the saved image is started. This can be done using *INIT-HOOKS* and *SAVE-HOOKS*. (describe '*init-hooks*) (describe '*save-hooks*) The first is the one you almost certainly want, the second one allows you to save eg. bits of state on the lisp side to be used by the initialization hook later should you need to do that. Cheers, -- Nikodemus |