Hi,
I’ve searched for an answer about this on the mailing list archives and on
Google but can’t find an answer. However, I find people with the same
problem than me. A similar issues was reported to this mailing list but it
was left unanswered:
http://www.libsdl.org/pipermail/sdl/2004-January/059074.html
So the problem is: after I call ‘SDL_SetVideoMode( mWidth, mHeight, 32,
SDL_OPENGL );’, the Win32 MessageBox call (that VC++ uses for asserts)
returns immediately with an ID_ABORT return value. In the context of
assertion, the assert code just ends up calling exit() to kill the process
because it can’t deal with that return value.
Here’s some code that shows my little test, I can build a repro app quickly
if you guys need it. I’m using VC7.1.
bool wfApp::init(void)
{
mInitOK = false;
if ( SDL_Init( SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_TIMER ) <
0 )
{
assert( 0 );
DebugPrintf(“SDL Error: %s\n”, SDL_GetError());
return false;
}
/// Set window title
char titleBuffer[kMaxChar] = {0};
_snprintf(titleBuffer, kMaxChar, "%s %i.%i", kAppTitle,
kAppMajorVersion, kAppMinorVersion);
SDL_WM_SetCaption( titleBuffer, NULL );
//////////////////////////////////////////////////////
// THIS ASSERT WORKS!
//////////////////////////////////////////////////////
assert( 0 );
/// Initialize output window
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ) ;
SDL_Surface* pMainSurf = SDL_SetVideoMode( mWidth, mHeight, 32,
SDL_OPENGL );
if( !pMainSurf )
{
assert( 0 );
DebugPrintf(“SDL Error: %s\n”, SDL_GetError());
return false;
}
//////////////////////////////////////////////////////
// THIS ASSERT KILLS THE PROGRAM!
//////////////////////////////////////////////////////
assert( 0 );
mInitOK = true;
return true;
}
It’s driving me nuts, all my asserts are not working. I’m a big assert
(ab)user.
Stephane