- (unless (fboundp 'load-foreign) ; not necessarily supported on all OSes..
- (sb-ext:quit :unix-status 52)) ; successfully unsupported:-|
- (load-foreign '("$testfilestem.so"))
+ (define-alien-variable environ (* c-string))
+ (defvar *environ* environ)
+ (handler-case
+ (load-shared-object "$testfilestem.so")
+ (sb-int:unsupported-operator ()
+ ;; At least as of sbcl-0.7.0.5, LOAD-SHARED-OBJECT isn't
+ ;; supported on every OS. In that case, there's nothing to test,
+ ;; and we can just fall through to success.
+ (sb-ext:quit :unix-status 52))) ; success convention for Lisp program
+ ;; Test that loading an object file didn't screw up our records
+ ;; of variables visible in runtime. (This was a bug until
+ ;; Nikodemus Siivola's patch in sbcl-0.8.5.50.)
+ (assert (= (sb-sys:sap-int (alien-sap *environ*))
+ (sb-sys:sap-int (alien-sap environ))))