(dirty) patch

Tristan Savatier tristan at mpegtv.com
Tue Aug 3 03:15:57 PDT 1999


I was able to make it work by calling
SDL_RegisterApp in SDL_Init, just before (*_init_func)
is called.

Of course, I had to use a private global to pass the
instance under the table (this is very dirty), but it seems
to work...

/* Stubs that load all of our symbols and initialize the SDL library */
int SDL_Init(Uint32 flags)
{
[...]

	/* all the symbols are loaded, but now we need to register the app */
	{
		extern void *Mtvp_instance;
		/* Create and register our class, then run main code */
		if (SDL_RegisterApp("mtvp", CS_BYTEALIGNCLIENT, Mtvp_instance) < 0 ) {
			_msg_printf("mtvp: Couldn't initialize SDL: %s\n", SDL_GetError());
			return -1;
		}
	}
	return((*_init_func)(flags));
}

Maybe a cleaner solution would be to pass a platform-specific
(void *) pointer as a second parameter to SDL_Init.  In the case
of Win32, it could be the Instance handle, maybe ?

-t



More information about the SDL mailing list