On Tue, Jan 09, 2001 at 06:49:10PM +0100, Martin Atzmueller wrote:
> now, since run-program is enabled, it might be worth to finally
> enable full load-foreign.
> I just tried this, but there is a comment in foreign.lisp, that
> ";; Note: Since SBCL has no *ENVIRONMENT-LIST*
> ;; variable, if this code is ever restored,
> ;; the default should be taken from the alien
> ;; "environ" variable.
> ;; do it!
> (env sb-ext:*environment-list*)"
> Unfortunately I do not know too much about the alien stuff, so this
> seemed not so easy after all.
> And then there is this "def-alien-variable" bug (?) that I reported.
OK, I said in the last message that I wouldn't fix this, but I seem
to've been mistaken.:-| The bug was created when I added declarations
(declare (type sb!kernel:lexenv env))
to the CMU CL versions of functions in host-alieneval.lisp. (IIRC
I added those after I got tired of chasing down bugs where the
cross-compiler was mixing up host compiler LEXENVs and
cross-compiler LEXENVs, and I wanted the compiler to flag them
all at compile time. I didn't realize at the time that
those variables could be NIL.) I've now changed the declarations to
(declare (type (or sb!kernel:lexenv null) env))
in sbcl-0.6.9.22, and DEF-ALIEN-VARIABLE works again, at least for
the simple example below.
> But, anyway, how can I use this
> char **environ
> that the comment seems to talk about?
> Do I have to use an alien type of "system-area-pointer"?
'man environ' on Linux or OpenBSD describes the C-level variable that
the comment refers to.
Here's an example of using the SB-ALIEN/SB-C-CALL machinery to get
to the C-level 'environ' variable:
(in-package :cl-user) ; to get SB-ALIEN and SB-C-CALL in USE-list
(def-alien-variable "environ" (* c-string))
(dotimes (i most-positive-fixnum)
(let ((thing (deref environ i)))
> Nevertheless, I think it would be nice, to have load-foreign, and if
> someone who knows more about using "alien" would be motivated to do
> it ... ;)
It would be nice.
William Harold Newman <william.newman@...>
PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C