-
Notifications
You must be signed in to change notification settings - Fork 510
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
It is not possible to call sapp_run
multiple times
#183
Comments
I haven't considered this use-case, but it's a good suggestion. It might be quite a few more places where this currently breaks though. The general idea is that every sokol API should properly clean up behind itself (in this case I think, _sapp_win32_setprocessdpiaware should be either be cleared at the end of sapp_run(), or all static variables should be cleared at start. Some places basically assume that static variables are cleared by the compiler at startup, but that's no longer true when shutting down and starting the API, but not the process. |
It's also not necessarily true if used in a dynamic library as I understand it - on some platforms (like the musl libc), dlclose() is actually a nop and a second dlopen just returns the same pointer from the first time. Not sure if this is also true on glibc, or Windows or anywhere else, but there's other situations where statics aren't going to be initialized to defaults. |
...better late then never... This is not quite the same as requested, but I've cleaned up the sokol headers a while ago so that the multiple shutdown/init cycles are possible. See this sample: https://github.com/floooh/sokol-samples/blob/master/sapp/restart-sapp.c |
I've seen the sample... works well! Next question is... will sapp support multiple windows (something like in |
There's a fairly advanced pull request for multiwindow-support here: I haven't checked yet how much work remains there to be done, but eventually at one point in the future, this will be merged. Don't hold your breath though ;) But if you need multiwindow support, this PR is the best place to start. |
I would like to make a Sokol extension for Rebol language and I would like to be able to open Sokol's thread using
sapp_run
call multiple times. Not at once, but when I close the first one, to be able open a new one without restarting the host application. That is now not possible because of this assert:sokol/sokol_app.h
Lines 4182 to 4183 in 5cf362a
Would you mind to replace this assert with just something like this?
Or should I instead do some additional cleanup on my side, when the
sapp_run
call ends?The text was updated successfully, but these errors were encountered: