Skip to content

Instantly share code, notes, and snippets.

@sshirokov
Created January 2, 2012 04:47
Show Gist options
  • Save sshirokov/1549389 to your computer and use it in GitHub Desktop.
Save sshirokov/1549389 to your computer and use it in GitHub Desktop.
A patch to help SBCL compiled cores find shared objects.
(with-unlocked-packages (:sb-alien)
(let ((function (symbol-function 'sb-alien::try-reopen-shared-object)))
(setf (symbol-function 'sb-alien::try-reopen-shared-object)
#'(lambda (obj)
"Look at the pathname of the library we are trying to re-open
and only use the full absolute path if the named file exists. Otherwise reduce the
path to the minimal relative form and defer the search to the OS dynamic linker."
(declare (type sb-alien::shared-object obj))
(let ((path (sb-alien::shared-object-pathname obj)))
(when (pathname-directory path)
(unless (probe-file path)
(let ((sub-path (make-pathname :name (pathname-name path)
:type (pathname-type path))))
(setf (sb-alien::shared-object-pathname obj) sub-path
(sb-alien::shared-object-namestring obj) (namestring sub-path))))))
(funcall function obj)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment