hi,
I’m currently having some serious problems with SDL:
i’ve written an SDL plugin for a script language , a DLL for win32
to be precise ;
the plugin DLL has an init() as well as an exit() function that is
called when the plugin is loaded/unloaded.
in init(), SDL_Init(0) is called
in exit(), SDL_Quit() is called
the plugin registers a Viewport class that has an open() and a
close() method.
in Viewport::open() SDL_InitSubSystem(SDL_INIT_VIDEO); is called
and in Viewport::close(), SDL_QuitSubSystem(SDL_INIT_VIDEO) is
called
SDL crashes horribly in SDL_InitSubSystem(SDL_INIT_VIDEO) if
the plugin is loaded, then unloaded and then loaded again while the
script engine executable is running. (the SE has an interactive
console mode which allows you to quickly re-run a script)
(the script engine has a "use" statement which triggers the plugin
loader)
if the engine executable is quit after running the script and then
completely restarted everything works ok
what is going wrong?
please notice that my application _dynamically_ loads SDL, it is not
linked with SDL so the usual SDL_main probably never gets called
i took a look at the SDL source, saw Sams comment about directinput
and added an
SDL_SetModuleHandle(GetModuleHandle(NULL));
call to the SDL plugin startup code but it didn't do the trick.
Regards,
Bastian Spiegel - independent software developer