>>>>> "ew" == Edi Weitz <[EMAIL PROTECTED]> writes:

  ew> The CMUCL manual says that "if a Lisp core image is saved (using
  ew> SAVE-LISP), all loaded foreign code is lost when the image is
  ew> restarted."

yep, that's the current official status.

  ew> What is the correct way to deal with saved cores and foreign libraries
  ew> in CMUCL? Or can't this be done?

if your foreign library is a DSO (a .so file that can be handled by
dlopen), and you use SYS::LOAD-OBJECT-FILE to load it instead of
EXT:LOAD-FOREIGN, you can try the following:

  
(defun reload-global-table ()
  (loop :for lib-entry in sys::*global-table*
        :for (sap . lib-path) = lib-entry
        :when lib-path :do
        (let ((new-sap (sys::dlopen (namestring lib-path)
                                    (logior sys::rtld-now sys::rtld-global))))
          (when (zerop (sys:sap-int new-sap))
            (error "Couldn't open library ~S: ~S" lib-path (sys::dlerror)))
          (setf (car lib-entry) new-sap)))
  (alien:alien-funcall (alien:extern-alien "os_resolve_data_linkage"
                                           (alien:function c-call:void))))

(compile 'reload-global-table)

(pushnew 'reload-global-table ext:*after-save-initializations*)

-- 
Eric Marsden                          <URL:http://www.laas.fr/~emarsden/>

Reply via email to