;; with DEFINE-SYMBOL-MACRO, keeping the code walkers
;; happy.
(:alien
- (%simple-eval original-exp lexenv))))
+ (sb!alien-internals:alien-value exp))))
(list
(let ((name (first exp))
(n-args (1- (length exp))))
(t (values (cdr binding) :variable)))
(case (sb!int:info :variable :kind symbol)
(:macro (values (macroexpand-1 symbol) :expansion))
- (:alien (let ((type (sb!int:info :variable :alien-info symbol)))
- (values (sb!alien::%heap-alien type)
- :variable)))
+ (:alien (values (sb!alien-internals:alien-value symbol) :variable))
(t (values (symbol-value symbol) :variable))))))
;;; Retrieve the function/macro binding of the symbol NAME in
(make-heap-alien-info :type type
:sap-form `(foreign-symbol-sap ',alien-name t)))))
+(defun alien-value (symbol)
+ #!+sb-doc
+ "Returns the value of the alien variable bound to SYMBOL. Signals an
+error if SYMBOL is not bound to an alien variable, or if the alien
+variable is undefined."
+ (%heap-alien (or (info :variable :alien-info symbol)
+ (error 'unbound-variable :name symbol))))
+
(defmacro extern-alien (name type &environment env)
#!+sb-doc
"Access the alien variable named NAME, assuming it is of type TYPE. This