OpenWatcom and SDL

I found no OpenWatcom makefiles or IDE project files in the sources of SDL 1.2.7
:frowning: After a long being experimenting I found out that SDL.DLL in VC and MingW
dirstributions as well as static (import) libraries does not work correctly with
OpenWatcom as it uses custom calling conventions. So full rebuild of the DLL
static libraries is needed. While compiling sdl_win32_main.c I learnt that
OpenWatcom atexit() does not accept explicit __cdecl functions, so I had to
change: lines N 223 and 224:

atexit((void (*)(void))cleanup_output);
atexit((void (*)(void))SDL_Quit);

However, this may cause a bug…

I found no OpenWatcom makefiles or IDE project files in the sources of SDL 1.2.7
:frowning: After a long being experimenting I found out that SDL.DLL in VC and MingW
dirstributions as well as static (import) libraries does not work correctly with
OpenWatcom as it uses custom calling conventions. So full rebuild of the DLL
static libraries is needed. While compiling sdl_win32_main.c I learnt that
OpenWatcom atexit() does not accept explicit __cdecl functions, so I had to
change: lines N 223 and 224:

atexit((void ()(void))cleanup_output);
atexit((void (
)(void))SDL_Quit);

However, this may cause a bug…

You should better create a wrapper for the SDL_Quit function,
this way “hiding” the calling convention:

void SDL_Quit_Wrapper()

SDL_Quit();

atexit(SDL_Quit_Wrapper);

There are some more small problems with building SDL
with OpenWatcom, for example when you want to create
a DLL from it, the DECLSPEC and SDLCALL keywords are
missing from some of the functions in the .c files (IIRC), so
some SDL functions do not get exported into the DLL.

DoodleOn Fri, 6 Aug 2004 20:36:48 +0000 (UTC), Yury Benesh wrote: