[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: embedded mzscheme and initializing the mzscheme environment as well as my own



Quoting "Gregory Lampshire":
> As part of the elaboration of my MLT_Enivornment component, I create the
> mzscheme environment and then add symbols and create mzscheme types in the
> mzscheme environment.  Since this Singleton is declared as a static object,
> it is elaborated prior to main.  I am wondering if it is improper to create
> the mzscheme environment prior to entering main.

As long as the Boehm GC (the default collector) correctly finds static
variables and the stack base, this will work fine. Put another way, it
will work unless you need to use scheme_set_stack_base() to set the
stack base and/or turn on explcitly-registered static variables.

It might not work if you run in FreeBSD (where the static-finding code
doesn't work reliably at the moment), or if you run in Solaris and Sun
releases a new version of the OS (which almost always seems to break
the GC). Depending on how the GC is compiled and how your library is
used in another application, it might not work in Windows when multple
OS threads are present.

I wish I could give a more comprehensive answer. The good news is that
Boehm continues to improve the GC; it's becoming so widely used that I
think future versions of OSes might actually provide reliable support
for the GC. The bad news is that there is still a steady stream of
problems, for now (which is why stand-alone MzScheme and MrEd use
scheme_set_stack_base() in v200).

Matthew