[Ecls-list] Problems with updating an external global variable

Matthew Mondor mm_lists at pulsar-zone.net
Wed Jul 17 17:39:54 UTC 2013


On Sun, 14 Jul 2013 00:31:27 +0900
Dietrich Bollmann <dietrich at formgames.org> wrote:

> I compiled my ECL lisp functions with asdf:make-build into a library.
> 
> Some functions depend on the value of a global variable which has to be set
> in the code using the library.
> 
> But when changing the value of the global variable in the code using the
> library, the library functions still use the old value...

I don't really understand why in your example code only the original
value is obtained, possibly that the scope of the variable is not the
expected one (that there are two such variables or such)?  I recommend
to use (setf c::*delete-files* nil) and to inspect the resulting C code.

Note also that for handling foreign pointers (other than :pointer-void
with C-INLINE which it handles implicitely), there are the public
interfaces ecl_make_pointer() and ecl_to_pointer().

In your next message I see that you seem to be doing it right to store
the context in a C variable (although I didn't test your code).  If
it's to store a unique global context on which the Lisp code should
have no control, it might not matter, but otherwise, it might be best
to have interface functions require the context parameter or to obtain
it from a dynamic/special variable, which would allow Lisp code to
handle multiple objects more elegantly than is generally possible from
C/C++ because of the power of dynamic scope...
-- 
Matt




More information about the ecl-devel mailing list