[plt-scheme] Resetting environment in embedded Scheme

From: scheme at phirho.com (scheme at phirho.com)
Date: Fri Jul 3 09:51:44 EDT 2009


While it was relatively straightforward and easy to get an embedded Scheme
running thanks to the docs I have not been able to find anything about
resetting the environment.
To illustrate my point, given the following sequence of actions:
1. embed scheme
2. call scheme (and return to embedding environment)
3. do some stuff (in embedding env)
4. call scheme again

How can I make sure, that the environment used in step 4 has the exact
same bindings etc. like that used in step 2 if I have no control over the
scheme code running there?
I tried with
- embedding all over again
- by replacing the environment via scheme_basic_env()
but both without success (they crash with what at first sight seem to be
invalid pointer dereferences).

Is there a protocol I'd have to follow? Where can I find it documented?

Thanks in advance for any hints!

Posted on the users mailing list.