X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fforeign.lisp;h=54ae8b0691a8f3a71e7fd57a5a364d1fb4d7146d;hb=f8893c7c658bf9d9e0757c63e47af2fdea810f04;hp=a02162c4cb65b5b4f39dad96d0b0a28adea7c32e;hpb=f319c3261c5eeb9c96dd003d7bb87664e0eea2fa;p=sbcl.git diff --git a/src/code/foreign.lisp b/src/code/foreign.lisp index a02162c..54ae8b0 100644 --- a/src/code/foreign.lisp +++ b/src/code/foreign.lisp @@ -52,13 +52,7 @@ ;;; On any OS where we don't support foreign object file loading, any ;;; query of a foreign symbol value is answered with "no definition ;;; known", i.e. NIL. -;;; -;;; (On any OS which *does* support foreign object file loading, this -;;; placeholder implementation is overwritten by a subsequent real -;;; implementation.) -;;; -;;; You may want to use SB-SYS:FOREIGN-SYMBOL-ADDRESS instead of -;;; calling this directly; see code/target-load.lisp. +#-(or linux sunos FreeBSD OpenBSD darwin) (defun get-dynamic-foreign-symbol-address (symbol) (declare (type simple-string symbol) (ignore symbol)) nil) @@ -68,7 +62,7 @@ ;;; work on any ELF system with dlopen(3) and dlsym(3) ;;; 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) +#-(or linux sunos FreeBSD OpenBSD darwin) (macrolet ((define-unsupported-fun (fun-name) `(defun ,fun-name (&rest rest) "unsupported on this system" @@ -76,7 +70,7 @@ (error 'unsupported-operator :name ',fun-name)))) (define-unsupported-fun load-1-foreign) (define-unsupported-fun load-foreign)) -#+(or linux FreeBSD OpenBSD) +#+(or linux sunos FreeBSD OpenBSD darwin) (progn ;;; flags for dlopen() @@ -118,7 +112,9 @@ *after-save-initializations*) (defvar *dso-linker* "/usr/bin/ld") -(defvar *dso-linker-options* '("-shared" "-o")) +(defvar *dso-linker-options* + #-darwin '("-shared" "-o") + #+darwin '("-bundle" "-o")) (sb-alien:define-alien-routine dlopen system-area-pointer (file sb-alien:c-string) (mode sb-alien:int)) @@ -188,6 +184,14 @@ (unless (zerop possible-result) (return possible-result))))) +;;; Dan Barlow's quick summary from IRC 2003-06-21: +;;; fwiw, load-foreign does random stuff with ld so that you can use +;;; it with static libraries +;;; if you have shared objects, load-1-foreign will do fine +;;; and +;;; I think my position on this matter is consistent with Tim Moore's: +;;; use (cmucl equivalent of) load-1-foreign, load-foreign is arse +;;; though he may say ass (defun load-foreign (files &key (libraries '("-lc"))