X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fforeign-load.lisp;h=d678b0de7896a19acf28bcea93944752d50c8c99;hb=15d6e7c9a2c3234f95dfe278046fa2fee1b0c007;hp=62ae30316d518f1d3fdc0184c938aa43b4bbf9e5;hpb=75b52379bdc2269961af6a1308eca63610f38ac3;p=sbcl.git diff --git a/src/code/foreign-load.lisp b/src/code/foreign-load.lisp index 62ae303..d678b0d 100644 --- a/src/code/foreign-load.lisp +++ b/src/code/foreign-load.lisp @@ -48,20 +48,11 @@ (defun load-shared-object (file) "Load a shared library/dynamic shared object file/general -dlopenable alien container. +dlopenable alien container, such as a .so on an ELF platform. -To use LOAD-SHARED-OBJECT, at the Unix command line do this: - - echo 'int summish(int x, int y) { return 1 + x + y; }' > /tmp/ffi-test.c - make /tmp/ffi-test.o # i.e. cc -c -o /tmp/ffi-test.o /tmp/ffi-test.c - ld -shared -o /tmp/ffi-test.so /tmp/ffi-test.o - -Then in SBCL do this: - - (load-shared-object \"/tmp/ffi-test.so\") - (define-alien-routine summish int (x int) (y int)) - -Now running (summish 10 20) should return 31." +References to foreign symbols in loaded shared objects do not survive +intact through SB-EXT:SAVE-LISP-AND die on all platforms. See +SB-EXT:SAVE-LISP-AND-DIE for details." (let* ((real-file (or (unix-namestring file) file)) (sap (dlopen-or-lose real-file)) (obj (make-shared-object :file real-file :sap sap))) @@ -84,7 +75,7 @@ Now running (summish 10 20) should return 31." ;;; Open libraries in *SHARED-OBJECTS* and the runtime. Called during ;;; initialization. (defun reopen-shared-objects () - ;; Ensure that the runtime is present in the list + ;; Ensure that the runtime is open (setf *runtime-dlhandle* (dlopen-or-lose nil) *shared-objects* (mapcar #'try-reopen-shared-object *shared-objects*)))