I have cygwin (not the cross-tools) installed on
Windows 2000 and like a lot of people am trying to get
SDL to work. I finally got it to work with a few
changes. I can get it to compile with the commands
after one source file modification (see below…)
./configure --enable-shared=no --prefix=/usr/local
and then to compile a program with SDL
sdl-config --cflags test.c
The problem comes when I try to run the exe. I get a
seg fault. The line that is causeing the problem is
in src/events/SDL_keyboard.c line 78
video is a pointer to a SDL_VideoDevice structure.
in the decliration of SDL_VideoDevice in
src/video/SDL_sysvideo.h there is a #ifdef HAVE_OPENGL
(line 199) which adds some members of opengl function
pointers to the structure.
At the beginning of the src/video/SDL_sysvideo.h file
HAVE_OPENGL is defined if WIN32 is defined (lines
40-46). The problem comes because in the
src/video/windx5/SDL_dx5video.c file WIN32 is defined
(from src/video/windx5/directx.h) so therefore
HAVE_OPENGL is defined. In src/video/SDL_video.c and
almost every other file which accesses the external
videodevice, HAVE_OPENGL is not defined because WIN32
is not defined so therefore the structure is different
for different files. And then the member InitOSKeymap
is at a different offset in the returned structure and
thus the video->InitOSKeymap member looks to different
memory locations for the data.
To fix this problem I just commented out the code in
SDL_sysvideo.h to look like… (lines 40-46)
// #ifdef WIN32
so that HAVE_OPENGL is always defined and thus the
structures are the same
this will break the compile on non-windows machines,
Yes, I compiled and ran a SDL program I wrote on Linux
without a modification to the source code, just
changed the Makefile.
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices