On Tuesday 25 June 2013 12:34:07 Schrober wrote:
Hm, now I have the problem that I cannot initialize subsystems from loaded
plugins in SDL2 anymore when using MXE (cannot test MSVC).
if(SDL_InitSubSystem(SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK
| SDL_INIT_HAPTIC | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
return 1;
}
works in the SDL_main function. But when done from a loaded DLL (plugin) it
just says:
"Unable to create Helper Window Class: Class already exists."
or (depending on whether using SDL_InitSubSystem/SDL_Init)
"Application didn't initialize properly, did you include SDL_main.h in the
file containing your main() function?"
It worked fine in the past with SDL1.2 and works fine with SDL2 under linux.
The plugin was loaded with LoadLibrary+GetProcAddress and compiled with
i686- w64-mingw32-gcc from mxe 8e7faf84df19346635ffff6c78cabc6a3d4afbc1.
So, I am now completely unsure how I should fix the SDL_MainIsReady from the
view of the plugins. Maybe, if the SDL gurus don't know: MXE is compiling
everything as static libraries. This maybe doesn't work on windows when the
state of SDL should have been shared between main program and plugin. But
now it is impossible to write a plugin with SDL support because I cannot
initialize the subsystems
Just as info for the developers: This regression was introduced in rev
cd5516b9263d - reverting it fixes the problem for me. Attached are both files