Open
Description
Suppose my program has one video module and one audio module. They each use SDL. I don't want the two modules to know about each other, or whether any other part of the program is also using SDL. Maybe the two modules even come from different crates.
With the SDL C API, this is fine. There's a function SDL_WasInit
, so each component of my program can check that and initialize if necessary.
With rust-sdl2
, as far as I can tell there's no way to hide away SDL in multiple modules like this. Each module has to get access to the Sdl
struct, and the only wait to do that is to call init
. Once one module has called init
, the other module will receive an error from init
and can't proceed.