[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
access of global variables from modules
From: |
Mr. Peter Ivanyi |
Subject: |
access of global variables from modules |
Date: |
Sat, 30 Mar 2002 22:43:45 +0000 |
Hello again,
I have another problem with modules.
If I have a module can the module access "global" variables.
I have an application, which defines some global variables.
The application also loads some modules and I would like to access
the global variables from the module.
How can I do it ? (I think I can put the global variables into a module
and another module can depend on it, but isn't there another way ?)
For example I have this module (gen.scm):
----------------------
(define-module (gen gen))
(export gen-hello)
(define (gen-hello)
(set! *G* 3)
(display "Hello World !")
(newline)
)
-------------------------
then I receive this
-------------------------
address@hidden $ guile
guile> (define *G* 1)
guile> (use-modules (gen gen))
guile> (gen-hello)
./gen/gen.scm:7:1: In expression (set! *G* 3):
./gen/gen.scm:7:1: Unbound variable: *G*
ABORT: (unbound-variable)
Type "(backtrace)" to get more information or "(debug)" to enter the debugger.
guile>
-------------------------
instead of setting *G* to 3 and then print "Hello World !".
Thanks, for your help in advance.
Peter Ivanyi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- access of global variables from modules,
Mr. Peter Ivanyi <=