Subset-SDL - win32 build problem

Hi all again,

After some poking around I found a fix …

One has to modify the SDL_main function for the case that video is
disabled.

Edit
src/main/win32/SDL_main.c

and supress the (in that case undefined) call to SDL_RegisterApp:

#ifndef DISABLE_VIDEO
/* Create and register our class, then run main code */
if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT,
GetModuleHandle(NULL)) < 0 ) {
ShowError(“WinMain() error”, SDL_GetError());
exit(1);
}
#endif

Cheers
Andreas

Andreas Schiffler wrote:>

Hi there,

I am using a smaller SDL .DLL using xmingw32 using a subset of the SDL
function that is to be used just for audio playback. This is the
configure line to do that:

CONFIGURE_FLAGS="–disable-debug --disable-video --disable-events
–disable-joystick --disable-cdrom --disable-arts --disable-nas"
cross-configure $CONFIGURE_FLAGS

I end up with a compact 32k DLL/.so. A Linux test program works well
with this lib using a standard main() routine.

My Windows test program has a line like this:

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR
szCmdLine, int iCmdShow)
{

}

When cross-compiling, I get this error:

usr/local/cross-tools/i386-mingw32msvc/lib/libSDLmain.a(SDL_main.o.bSDL_main.o.b):
In function console_main': /home/andreas/Projects/Libraries/SDL-1.2/src/main/SDL_main.c:166: undefined reference toSDL_RegisterApp’

Any ideas on how to resolve this …?

Ciao
Andreas

One has to modify the SDL_main function for the case that video is
disabled.

Thanks, your fix is in CVS. However, make sure that sound works
correctly with your app; see my previous message for details.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam,

Thanks, your fix is in CVS. However, make sure that sound works
correctly with your app; see my previous message for details.

Sound works just fine. This is on a Win98SE box - I haven’t tried
anything else.

In my test program I am using a single main() routine and
SDL_Init(SDL_INIT_AUDIO) plus my sound code for playback. The
test-program runs without console, icon, taskbar entry etc. playing
sound. It does create stdout.txt/stderr.txt as usual. Everything seems
in order.

Ciao
Andreas