New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple embedded sessions #512
Comments
One thing you can do right now is spawn different environments and execute your code in those environments with eval. It's not quite the same as completely different sessions since you can change global and thread parameters that are shared across all environments, but it's close and you can hide the effects of modifying parameters with You can either construct fresh environments with |
thanks @gwatt ! Wasn't aware of the More specifically, my issue was when making a dynamic C++ library using scheme, to be loaded by a host application. The host application could instantiate multiple instances of this library. (more specifically it's about doing a VST plugin, being loaded by a VST host) The issue that I stumbled upon was that scheme was already initiated when a 2nd instance of my plugin is loaded, thus crashing. Thanks again. |
If it's acceptable to have plugins sharing the same scheme runtime but with their own scheme environments, you can check that the scheme system is already initialized and then skip the rest as appropriate. int initialized = 0;
void set_initialized(void) {
initialized = 1;
}
// on plugin initialization
Sscheme_init(&set_initialized);
if (!initialized) {
Sregister_bootfile(...);
Sbuild_heap(...);
} |
Yeah that's more or less what I thought of doing. For reference, that's the error I was getting |
I'm wishing to embed chez in a c++ application.
Is it possible to initiate multiple independent scheme sessions?
I see in https://github.com/cisco/ChezScheme/blob/b7f161b/c/scheme.c#L38 that the
heap_state
is static. So.. I guess not possible? Would there be any plans to support this?The text was updated successfully, but these errors were encountered: