Invalid parameter passed to C runtime function

Hi All,

I’m using SDL to get an OpenGL window and to handle audio and input. I
used pre-built mingw32 binaries, and my application was crashing. When
run in gdb, I could see “warning: Invalid parameter passed to C runtime
function.” repeated four times when SDL_SetVideoMode is called.

I compiled SDL-1.2.15 myself and the application is not crashing
anymore, but the messages still come up when I run it in gdb.

Is it something to worry about?

Thanks,

Andre

Only now that the problem is solved and I wanted to give everyone an
update I saw how little information I gave in my first post…

OS: Windows 8
Development environment: MinGW+MSYS
GCC: 4.7.2
SDL: 1.2.15
SDL_image: 1.2.12
SDL_mixer: 1.2.12

After some changes to my code, the crashes came back and the only way
to run the app was inside GDB, so I had no choice but to discover what
was going on.

I was linking my executable against the SDL DLLs, since it’s a GCC
feature. When ran from the command line, the application crashes. When
ran from inside GDB, the message “warning: Invalid parameter passed to C
runtime function.” appears four times during the SDL_SetVideoMode call,
but the application does not crash and run just fine.

Following a lead, I put a breakpoint at OutputDebugStringA to see if I
could pinpoint where exactly the problem was, but GDB didn’t show
anything useful in the call stack when the breakpoint hit. I then tried
to debug the application from the crash window, choosing VS2012 as the
debugger. In VS the call stack showed many ATI DLLs which convinced me
the problem wasn’t in SDL, but still I wanted to know what the problem
was (maybe SDL was making an OpenGL call that my ATI driver wasn’t
liking and maybe I could recompile SDL with changes to make the problem
go away for me while still working for others.)

Hoping to debug the SDL_SetVideoMode call, I linked my executable
against libSDL.a (SDL_image and SDL_mixer were still linked directly as
DLLs), and, to my surprise, the problem went away.

So I made the executable link to libSDL.dll.a, libSDLmain.a,
SDL_image.lib and SDL_mixer.lib (all from development binaries
downloaded from libsdl.org.) The warning message still appears when I
run the app in GDB, but it no longer crashes when ran from the command
line. Maybe some day I’ll compile SDL with debug info and see where the
problem happens, but for now there’s no need to.

Cheers,

AndreOn 02/07/2013 21:20, Andre Leiradella wrote:

Hi All,

I’m using SDL to get an OpenGL window and to handle audio and input. I
used pre-built mingw32 binaries, and my application was crashing. When
run in gdb, I could see “warning: Invalid parameter passed to C
runtime function.” repeated four times when SDL_SetVideoMode is called.

I compiled SDL-1.2.15 myself and the application is not crashing
anymore, but the messages still come up when I run it in gdb.

Is it something to worry about?

Thanks,

Andre


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org