A Scheme environment is represented by a structure of type Scheme_Env. Calling scheme_basic_env returns an environment that includes all of the standard Scheme global functions and syntax.
scheme_basic_env should only be called once by an embedding program, before any other MzScheme functions are called. The environment that is returned is also the global environment for the main MzScheme thread. MzScheme extensions cannot call scheme_basic_env.
The scheme functions load and eval always use the current global environment. New primitive procedures must follow this convention. For more information on threads and their environments, see section 3.10.
New values can be added as globals in an evironment using scheme_add_global. scheme_lookup_global takes a Scheme symbol and returns the global value for that name, or NULL if the symbol is undefined.
An enviroment is extended with local variable frames by using scheme_add_frame or scheme_new_frame and scheme_extend_env. An evironment should only be extended by primitive syntax. Primitive syntax compilation uses special compile-time environments, while syntax execution uses a run-time environment. Both of these are asssigned the C type Scheme_Env*, but the functions used to access and extend a compile-time environment are different than for a run-time environment. Global variables can be accessed and set in the same way with either a compile-time or run-time environment.