[cffi-devel] %load-foreign-library on SBCL

Elliott Slaughter elliottslaughter at gmail.com
Fri Jun 12 20:24:34 UTC 2009


Hi,

I have a question about the implementation of %load-foreign-library on SBCL.
It seems that the call to load-shared-object remembers the absolute pathname
to the library that is loaded unless :dont-save t is used. This causes
portability issues for my application, which can't load from the same path
when used on different systems. Is there any reason to choose this behavior?

Of course, with :dont-save t, the user then has to call use-foreign-library
again when starting up from the saved image, but I find this preferable to
the crash I receive otherwise.

An example patch is included below.

Thanks.

--- src/cffi-sbcl.lisp~ 2009-04-14 19:33:40.000000000 -0700
+++ src/cffi-sbcl.lisp  2009-04-03 15:28:37.000000000 -0700
@@ -324,7 +324,7 @@
 (defun %load-foreign-library (name path)
  "Load a foreign library."
  (declare (ignore name))
-  (load-shared-object path))
+  (load-shared-object path :dont-save t))

 ;;; SBCL 1.0.21.15 renamed SB-ALIEN::SHARED-OBJECT-FILE but introduced
 ;;; SB-ALIEN:UNLOAD-SHARED-OBJECT which we can use instead.

-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20090612/d2e8f1de/attachment.html>


More information about the cffi-devel mailing list