X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fforeign.lisp;h=f6101db16f56ed471609fd43966332b91be72911;hb=a8161e77843ee18a99ec30dd57f796264dfac05a;hp=96b0cde0827ee74353e5338e03eead031bbe2af9;hpb=e33fb894f991b2926d8f3bace9058e4c0b2c3a37;p=sbcl.git diff --git a/src/code/foreign.lisp b/src/code/foreign.lisp index 96b0cde..f6101db 100644 --- a/src/code/foreign.lisp +++ b/src/code/foreign.lisp @@ -10,7 +10,7 @@ ;;;; provided with absolutely no warranty. See the COPYING and CREDITS ;;;; files for more information. -(in-package "SB-SYS") ; (SB-SYS, not SB!SYS, since we're built in warm load.) +(in-package "SB-ALIEN") ; (SB-ALIEN, not SB!ALIEN, since we're in warm load.) (defun pick-temporary-file-name (&optional ;; KLUDGE: There are various security @@ -54,7 +54,7 @@ ;;; placeholder implementation is overwritten by a subsequent real ;;; implementation.) ;;; -;;; You may want to use sb-sys:foreign-symbol-address instead of +;;; You may want to use SB-SYS:FOREIGN-SYMBOL-ADDRESS instead of ;;; calling this directly; see code/target-load.lisp. (defun get-dynamic-foreign-symbol-address (symbol) (declare (type simple-string symbol) (ignore symbol)) @@ -63,7 +63,17 @@ ;;; dlsym()-based implementation of GET-DYNAMIC-FOREIGN-SYMBOL-ADDRESS ;;; and functions (e.g. LOAD-FOREIGN) which affect it. This should ;;; work on any ELF system with dlopen(3) and dlsym(3) -#+(or linux FreeBSD) +;;; It also works on OpenBSD, which isn't ELF, but is otherwise modern +;;; enough to have a fairly well working dlopen/dlsym implementation. +#-(or linux FreeBSD OpenBSD) +(macrolet ((define-unsupported-fun (fun-name) + `(defun ,fun-name (&rest rest) + "unsupported on this system" + (declare (ignore rest)) + (error 'unsupported-operator :name ',fun-name)))) + (define-unsupported-fun load-1-foreign) + (define-unsupported-fun load-foreign)) +#+(or linux FreeBSD OpenBSD) (progn ;;; flags for dlopen() @@ -105,15 +115,15 @@ *after-save-initializations*) (defvar *dso-linker* "/usr/bin/ld") -(defvar *dso-linker-options* '("-G" "-o")) +(defvar *dso-linker-options* '("-shared" "-o")) (sb-alien:define-alien-routine dlopen system-area-pointer - (file sb-c-call:c-string) (mode sb-c-call:int)) + (file sb-alien:c-string) (mode sb-alien:int)) (sb-alien:define-alien-routine dlsym system-area-pointer (lib system-area-pointer) - (name sb-c-call:c-string)) -(sb-alien:define-alien-routine dlerror sb-c-call:c-string) + (name sb-alien:c-string)) +(sb-alien:define-alien-routine dlerror sb-alien:c-string) ;;; Ensure that we've opened our own binary so we can dynamically resolve ;;; symbols in the C runtime.