SDL_CreateThread();

Hi (again).

I’m using SDL-0.8.10 under win32
and
SDL-0.8.11 under linux rh5.2
the same code compiles fine under the both system.
but under linux it generates this (using gdb)
Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) bt
#0 0x0 in ?? ()
#1 0x8048a04 in NetInit () at netserver.cpp:58
#2 0x80489d9 in main () at main.c:22

line 58 is:
hSocketThread = SDL_CreateThread(SocketThread,NULL);

hSocketThread and SocketThread are defined like this:
static SDL_Thread *hSocketThread;
static void SocketThread(void *Param);

the program works without problem in win32 enviroment.

anyone have anyidea whats wrong?
netserver.cpp is compiled with g++ and
main.c with gcc
flags -lSDL -ldl

/andreas

SDL-0.8.11 under linux rh5.2
the same code compiles fine under the both system.
but under linux it generates this (using gdb)
Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) bt
#0 0x0 in ?? ()
#1 0x8048a04 in NetInit () at netserver.cpp:58
#2 0x80489d9 in main () at main.c:22

line 58 is:
hSocketThread = SDL_CreateThread(SocketThread,NULL);

Is that the first SDL function you call after the Init?
If so, it’s possible that the SDL_Init() is failing, and the shared
library functions haven’t been loaded.

If not, can you send me code to reproduce the problem?

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

At 15:35 1999-04-30 -0700, you wrote:

SDL-0.8.11 under linux rh5.2
the same code compiles fine under the both system.
but under linux it generates this (using gdb)
Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) bt
#0 0x0 in ?? ()
#1 0x8048a04 in NetInit () at netserver.cpp:58
#2 0x80489d9 in main () at main.c:22

line 58 is:
hSocketThread = SDL_CreateThread(SocketThread,NULL);

Is that the first SDL function you call after the Init?
If so, it’s possible that the SDL_Init() is failing, and the shared
library functions haven’t been loaded.
it’s the first first SDL call after SDL_Init();
i call SDL_Init();
as
SDL_Init(SDL_INIT_TIMER);

should it be something else? it works in windows anyway…

/andreas

Is that the first SDL function you call after the Init?
If so, it’s possible that the SDL_Init() is failing, and the shared
library functions haven’t been loaded.
it’s the first first SDL call after SDL_Init();
i call SDL_Init();
as
SDL_Init(SDL_INIT_TIMER);

should it be something else? it works in windows anyway…

Check the return value, it should be 0. If it isn’t, print out the
return value of SDL_GetError() to find out what’s wrong.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/