Linking SDL in Linux

I am writing a dynamic library which relies on SDL and is linked to libGL, libGLU and linked to SDL via sdl-config --libs --cflags. My library is named libMGE.

I’m compiling a simple test program that relies on my library, and is linked to my libMGE library.

When I execute the test program, the SDL window appears but doesn’t respond until i attempt to close the program with a ctrl+c (SIGTERM) – then suddenly it jumps to life! It continues to work normally after this, and another ctrl+c closes it.

The code is cross platform and my windows implementation is working fine, so I think its relating to how im compiling or linking the library… is there some gcc equivelant to the “multi threaded library” option i use in visual studio when compiling against SDL? Or what else could I have done wrong?

post a link to the source ?

mattOn Thu, 14 Jan 2010, mercior wrote:

I am writing a dynamic library which relies on SDL and is linked to libGL, libGLU and linked to SDL via sdl-config --libs --cflags. My library is named libMGE.

I’m compiling a simple test program that relies on my library, and is linked to my libMGE library.

When I execute the test program, the SDL window appears but doesn’t respond until i attempt to close the program with a ctrl+c (SIGTERM) – then suddenly it jumps to life! It continues to work normally after this, and another ctrl+c closes it.

The code is cross platform and my windows implementation is working fine, so I think its relating to how im compiling or linking the library… is there some gcc equivelant to the “multi threaded library” option i use in visual studio when compiling against SDL? Or what else could I have done wrong?

Send us the output of strace.

Run your program with the same command you usually do, but prepend the
command with “strace”

An easy way to redirect the output to a file is with &> filename
appended to the command.

So for the command “./mygame 1 2 3” use this command:

strace ./mygame 1 2 3 &> log

Then send us the “log” file.

This might make the problem clear without the need for us inspecting
your entire source code :)On Thu, Jan 14, 2010 at 11:52 AM, mercior wrote:

I am writing a dynamic library which relies on SDL and is linked to libGL,
libGLU and linked to SDL via sdl-config --libs --cflags. My library is
named libMGE.

I’m compiling a simple test program that relies on my library, and is linked
to my libMGE library.

When I execute the test program, the SDL window appears but doesn’t respond
until i attempt to close the program with a ctrl+c (SIGTERM) – then
suddenly it jumps to life! It continues to work normally after this, and
another ctrl+c closes it.

The code is cross platform and my windows implementation is working fine, so
I think its relating to how im compiling or linking the library… is there
some gcc equivelant to the “multi threaded library” option i use in visual
studio when compiling against SDL? Or what else could I have done wrong?


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


http://codebad.com/

I have since solved the issue, which turned out to not be a linking issue at all but rather a misunderstanding between Sleep() and sleep() :frowning: The hanging was caused by a 3 minute sleep() call. Thanks for offering your help, though!

Have you looked into SDL_Delay()?

Jonny DOn Thu, Jan 14, 2010 at 11:25 PM, mercior wrote:

I have since solved the issue, which turned out to not be a linking issue
at all but rather a misunderstanding between Sleep() and sleep() [image:
Sad] The hanging was caused by a 3 minute sleep() call. Thanks for
offering your help, though!


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