changeset 1769:290b5baf2fca

Fixed bug #215 The current SVN trunk is missing the SDLCALL specifier at numerous locations. It has to be added for all (possibly user provided) callbacks. I stumbled over this while creating a makefile for the OpenWatcom compiler for Win32.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 07 May 2006 03:40:06 +0000
parents 814f9f2c7a33
children 1632155c67e5
files include/SDL_stdinc.h src/audio/SDL_audio.c src/audio/SDL_audio_c.h src/audio/SDL_audiocvt.c src/events/SDL_events.c src/file/SDL_rwops.c src/main/win32/SDL_win32_main.c src/thread/SDL_thread.c src/thread/win32/SDL_systhread.c src/video/wincommon/SDL_wingl.c test/loopwave.c test/testerror.c test/testhread.c test/testlock.c test/testsem.c test/testtimer.c test/testwm.c test/threadwin.c test/torturethread.c
diffstat 19 files changed, 85 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/include/SDL_stdinc.h	Fri May 05 05:50:26 2006 +0000
+++ b/include/SDL_stdinc.h	Sun May 07 03:40:06 2006 +0000
@@ -168,6 +168,8 @@
 # elif defined(_MSC_VER)
 #  include <malloc.h>
 #  define alloca _alloca
+# elif defined(__WATCOMC__)
+#  include <malloc.h>
 # elif defined(__AIX__)
   #pragma alloca
 # else
--- a/src/audio/SDL_audio.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/audio/SDL_audio.c	Sun May 07 03:40:06 2006 +0000
@@ -120,13 +120,13 @@
 #endif
 
 /* The general mixing thread function */
-int SDL_RunAudio(void *audiop)
+int SDLCALL SDL_RunAudio(void *audiop)
 {
 	SDL_AudioDevice *audio = (SDL_AudioDevice *)audiop;
 	Uint8 *stream;
 	int    stream_len;
 	void  *udata;
-	void (*fill)(void *userdata,Uint8 *stream, int len);
+	void (SDLCALL *fill)(void *userdata,Uint8 *stream, int len);
 	int    silence;
 #if SDL_AUDIO_DRIVER_AHI
 	int started = 0;
--- a/src/audio/SDL_audio_c.h	Fri May 05 05:50:26 2006 +0000
+++ b/src/audio/SDL_audio_c.h	Sun May 07 03:40:06 2006 +0000
@@ -31,4 +31,4 @@
 extern void SDL_CalculateAudioSpec(SDL_AudioSpec *spec);
 
 /* The actual mixing thread function */
-extern int SDL_RunAudio(void *audiop);
+extern int SDLCALL SDL_RunAudio(void *audiop);
--- a/src/audio/SDL_audiocvt.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/audio/SDL_audiocvt.c	Sun May 07 03:40:06 2006 +0000
@@ -27,7 +27,7 @@
 
 
 /* Effectively mix right and left channels into a single channel */
-void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Sint32 sample;
@@ -169,7 +169,7 @@
 }
 
 /* Discard top 4 channels */
-void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Sint32 lsample, rsample;
@@ -285,7 +285,7 @@
 
 
 /* Discard top 2 channels of 6 */
-void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Sint32 lsample, rsample;
@@ -400,7 +400,7 @@
 }
 
 /* Duplicate a mono channel to both stereo channels */
-void SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 
@@ -438,7 +438,7 @@
 
 
 /* Duplicate a stereo channel to a pseudo-5.1 stream */
-void SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 
@@ -615,7 +615,7 @@
 
 
 /* Duplicate a stereo channel to a pseudo-4.0 stream */
-void SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 
@@ -768,7 +768,7 @@
 
 
 /* Convert 8-bit to 16-bit - LSB */
-void SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -791,7 +791,7 @@
 	}
 }
 /* Convert 8-bit to 16-bit - MSB */
-void SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -815,7 +815,7 @@
 }
 
 /* Convert 16-bit to 8-bit */
-void SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -841,7 +841,7 @@
 }
 
 /* Toggle signed/unsigned */
-void SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *data;
@@ -870,7 +870,7 @@
 }
 
 /* Toggle endianness */
-void SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *data, tmp;
@@ -892,7 +892,7 @@
 }
 
 /* Convert rate up by multiple of 2 */
-void SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -930,7 +930,7 @@
 
 
 /* Convert rate up by multiple of 2, for stereo */
-void SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -973,7 +973,7 @@
 }
 
 /* Convert rate up by multiple of 2, for quad */
-void SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -1029,7 +1029,7 @@
 
 
 /* Convert rate up by multiple of 2, for 5.1 */
-void SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -1096,7 +1096,7 @@
 }
 
 /* Convert rate down by multiple of 2 */
-void SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -1131,7 +1131,7 @@
 
 
 /* Convert rate down by multiple of 2, for stereo */
-void SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -1169,7 +1169,7 @@
 
 
 /* Convert rate down by multiple of 2, for quad */
-void SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -1212,7 +1212,7 @@
 }
 
 /* Convert rate down by multiple of 2, for 5.1 */
-void SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format)
 {
 	int i;
 	Uint8 *src, *dst;
@@ -1261,7 +1261,7 @@
 }
 
 /* Very slow rate conversion routine */
-void SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format)
+void SDLCALL SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format)
 {
 	double ipos;
 	int i, clen;
@@ -1474,7 +1474,7 @@
 		Uint32 hi_rate, lo_rate;
 		int len_mult;
 		double len_ratio;
-		void (*rate_cvt)(SDL_AudioCVT *cvt, Uint16 format);
+		void (SDLCALL *rate_cvt)(SDL_AudioCVT *cvt, Uint16 format);
 
 		if ( src_rate > dst_rate ) {
 			hi_rate = src_rate;
--- a/src/events/SDL_events.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/events/SDL_events.c	Sun May 07 03:40:06 2006 +0000
@@ -87,7 +87,7 @@
 #include <time.h>
 #endif
 
-static int SDL_GobbleEvents(void *unused)
+static int SDLCALL SDL_GobbleEvents(void *unused)
 {
 	event_thread = SDL_ThreadID();
 
--- a/src/file/SDL_rwops.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/file/SDL_rwops.c	Sun May 07 03:40:06 2006 +0000
@@ -43,7 +43,7 @@
 #define INVALID_SET_FILE_POINTER 0xFFFFFFFF
 #endif
 
-static int win32_file_open(SDL_RWops *context, const char *filename, const char *mode)
+static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, const char *mode)
 {
 #ifndef _WIN32_WCE
 	UINT	old_error_mode;
@@ -108,7 +108,7 @@
 	
 	return 0; /* ok */
 }
-static int win32_file_seek(SDL_RWops *context, int offset, int whence)
+static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
 {
 	DWORD win32whence;
 	int   file_pos;
@@ -138,7 +138,7 @@
 	SDL_Error(SDL_EFSEEK);
 	return -1; /* error */
 }
-static int win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum)
+static int SDLCALL win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum)
 {
 	
 	int		total_bytes; 
@@ -156,7 +156,7 @@
 	nread = byte_read/size;
 	return nread;
 }
-static int win32_file_write(SDL_RWops *context, const void *ptr, int size, int num)
+static int SDLCALL win32_file_write(SDL_RWops *context, const void *ptr, int size, int num)
 {
 	
 	int		total_bytes; 
@@ -183,7 +183,7 @@
 	nwritten = byte_written/size;
 	return nwritten;
 }
-static int win32_file_close(SDL_RWops *context)
+static int SDLCALL win32_file_close(SDL_RWops *context)
 {
 	
 	if ( context ) {								
@@ -201,7 +201,7 @@
 
 /* Functions to read/write stdio file pointers */
 
-static int stdio_seek(SDL_RWops *context, int offset, int whence)
+static int SDLCALL stdio_seek(SDL_RWops *context, int offset, int whence)
 {
 	if ( fseek(context->hidden.stdio.fp, offset, whence) == 0 ) {
 		return(ftell(context->hidden.stdio.fp));
@@ -210,7 +210,7 @@
 		return(-1);
 	}
 }
-static int stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum)
+static int SDLCALL stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum)
 {
 	size_t nread;
 
@@ -220,7 +220,7 @@
 	}
 	return(nread);
 }
-static int stdio_write(SDL_RWops *context, const void *ptr, int size, int num)
+static int SDLCALL stdio_write(SDL_RWops *context, const void *ptr, int size, int num)
 {
 	size_t nwrote;
 
@@ -230,7 +230,7 @@
 	}
 	return(nwrote);
 }
-static int stdio_close(SDL_RWops *context)
+static int SDLCALL stdio_close(SDL_RWops *context)
 {
 	if ( context ) {
 		if ( context->hidden.stdio.autoclose ) {
@@ -245,7 +245,7 @@
 
 /* Functions to read/write memory pointers */
 
-static int mem_seek(SDL_RWops *context, int offset, int whence)
+static int SDLCALL mem_seek(SDL_RWops *context, int offset, int whence)
 {
 	Uint8 *newpos;
 
@@ -272,7 +272,7 @@
 	context->hidden.mem.here = newpos;
 	return(context->hidden.mem.here-context->hidden.mem.base);
 }
-static int mem_read(SDL_RWops *context, void *ptr, int size, int maxnum)
+static int SDLCALL mem_read(SDL_RWops *context, void *ptr, int size, int maxnum)
 {
 	size_t total_bytes;
 	size_t mem_available;
@@ -292,7 +292,7 @@
 
 	return (total_bytes / size);
 }
-static int mem_write(SDL_RWops *context, const void *ptr, int size, int num)
+static int SDLCALL mem_write(SDL_RWops *context, const void *ptr, int size, int num)
 {
 	if ( (context->hidden.mem.here + (num*size)) > context->hidden.mem.stop ) {
 		num = (context->hidden.mem.stop-context->hidden.mem.here)/size;
@@ -301,12 +301,12 @@
 	context->hidden.mem.here += num*size;
 	return(num);
 }
-static int mem_writeconst(SDL_RWops *context, const void *ptr, int size, int num)
+static int SDLCALL mem_writeconst(SDL_RWops *context, const void *ptr, int size, int num)
 {
 	SDL_SetError("Can't write to read-only memory");
 	return(-1);
 }
-static int mem_close(SDL_RWops *context)
+static int SDLCALL mem_close(SDL_RWops *context)
 {
 	if ( context ) {
 		SDL_FreeRW(context);
--- a/src/main/win32/SDL_win32_main.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/main/win32/SDL_win32_main.c	Sun May 07 03:40:06 2006 +0000
@@ -121,8 +121,15 @@
 	return FALSE;
 }
 
+/* SDL_Quit() shouldn't be used with atexit() directly because
+   calling conventions may differ... */
+static void cleanup(void)
+{
+	SDL_Quit();
+}
+
 /* Remove the output files if there was no output written */
-static void __cdecl cleanup_output(void)
+static void cleanup_output(void)
 {
 #ifndef NO_STDIO_REDIRECT
 	FILE *file;
@@ -188,7 +195,7 @@
 	if ( bufp == NULL ) {
 		return OutOfMemory();
 	}
-	SDL_strlcpy(bufp, appname, n);
+	SDL_strlcpy(bufp, appname, n+1);
 	appname = bufp;
 
 	/* Load SDL dynamic link library */
@@ -197,7 +204,7 @@
 		return(FALSE);
 	}
 	atexit(cleanup_output);
-	atexit(SDL_Quit);
+	atexit(cleanup);
 
 	/* Sam:
 	   We still need to pass in the application handle so that
--- a/src/thread/SDL_thread.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/thread/SDL_thread.c	Sun May 07 03:40:06 2006 +0000
@@ -168,7 +168,7 @@
 
 /* Arguments and callback to setup and run the user thread function */
 typedef struct {
-	int (*func)(void *);
+	int (SDLCALL *func)(void *);
 	void *data;
 	SDL_Thread *info;
 	SDL_sem *wait;
@@ -177,7 +177,7 @@
 void SDL_RunThread(void *data)
 {
 	thread_args *args;
-	int (*userfunc)(void *);
+	int (SDLCALL *userfunc)(void *);
 	void *userdata;
 	int *statusloc;
 
@@ -204,9 +204,9 @@
 
 #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
 #undef SDL_CreateThread
-DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
+DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
 #else
-DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data)
+DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data)
 #endif
 {
 	SDL_Thread *thread;
--- a/src/thread/win32/SDL_systhread.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/thread/win32/SDL_systhread.c	Sun May 07 03:40:06 2006 +0000
@@ -41,6 +41,15 @@
         unsigned (__stdcall *func)(void *), void *arg, 
         unsigned, unsigned *threadID);
 typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
+#elif defined(__WATCOMC__)
+/* This is for Watcom targets except OS2 */
+#if __WATCOMC__ < 1240
+#define __watcall
+#endif
+typedef unsigned long (__watcall *pfnSDL_CurrentBeginThread) (void *, unsigned,
+        unsigned (__stdcall *func)(void *), void *arg, 
+        unsigned, unsigned *threadID);
+typedef void (__watcall *pfnSDL_CurrentEndThread)(unsigned code);
 #else
 typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
         unsigned (__stdcall *func)(void *), void *arg, 
--- a/src/video/wincommon/SDL_wingl.c	Fri May 05 05:50:26 2006 +0000
+++ b/src/video/wincommon/SDL_wingl.c	Sun May 07 03:40:06 2006 +0000
@@ -177,7 +177,7 @@
 	int iAttribs[64];
 	int *iAttr;
 	float fAttribs[1] = { 0 };
-	const GLubyte *(*glGetStringFunc)(GLenum);
+	const GLubyte *(WINAPI *glGetStringFunc)(GLenum);
 	const char *wglext;
 
 	/* load the gl driver from a default path */
--- a/test/loopwave.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/loopwave.c	Sun May 07 03:40:06 2006 +0000
@@ -32,7 +32,7 @@
 }
 
 
-void fillerup(void *unused, Uint8 *stream, int len)
+void SDLCALL fillerup(void *unused, Uint8 *stream, int len)
 {
 	Uint8 *waveptr;
 	int    waveleft;
--- a/test/testerror.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/testerror.c	Sun May 07 03:40:06 2006 +0000
@@ -17,7 +17,7 @@
 	exit(rc);
 }
 
-int ThreadFunc(void *data)
+int SDLCALL ThreadFunc(void *data)
 {
 	/* Set the child thread error string */
 	SDL_SetError("Thread %s (%d) had a problem: %s",
--- a/test/testhread.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/testhread.c	Sun May 07 03:40:06 2006 +0000
@@ -17,7 +17,7 @@
 	exit(rc);
 }
 
-int ThreadFunc(void *data)
+int SDLCALL ThreadFunc(void *data)
 {
 	printf("Started thread %s: My thread id is %u\n",
 				(char *)data, SDL_ThreadID());
--- a/test/testlock.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/testlock.c	Sun May 07 03:40:06 2006 +0000
@@ -5,7 +5,6 @@
 
 #include <signal.h>
 #include <stdio.h>
-#include <stdlib.h>
 
 #include "SDL.h"
 #include "SDL_mutex.h"
@@ -14,6 +13,7 @@
 static SDL_mutex *mutex = NULL;
 static Uint32 mainthread;
 static SDL_Thread *threads[6];
+static volatile int doterminate = 0;
 
 /*
  * SDL_Quit() shouldn't be used with atexit() directly because
@@ -31,8 +31,8 @@
 	
 void terminate(int sig)
 {
-	printf("Process %u:  raising SIGTERM\n", SDL_ThreadID());
-	raise(SIGTERM);
+	signal(SIGINT, terminate);
+	doterminate = 1;
 }
 void closemutex(int sig)
 {
@@ -44,7 +44,7 @@
 	SDL_DestroyMutex(mutex);
 	exit(sig);
 }
-int Run(void *data)
+int SDLCALL Run(void *data)
 {
 	if ( SDL_ThreadID() == mainthread )
 		signal(SIGTERM, closemutex);
@@ -63,6 +63,10 @@
 		}
 		/* If this sleep isn't done, then threads may starve */
 		SDL_Delay(10);
+		if (SDL_ThreadID() == mainthread && doterminate) {
+			printf("Process %u:  raising SIGTERM\n", SDL_ThreadID());
+			raise(SIGTERM);
+		}
 	}
 	return(0);
 }
--- a/test/testsem.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/testsem.c	Sun May 07 03:40:06 2006 +0000
@@ -13,7 +13,7 @@
 static SDL_sem *sem;
 int alive = 1;
 
-int ThreadFunc(void *data)
+int SDLCALL ThreadFunc(void *data)
 {
 	int threadnum = (int)(uintptr_t)data;
 	while ( alive ) {
--- a/test/testtimer.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/testtimer.c	Sun May 07 03:40:06 2006 +0000
@@ -12,13 +12,13 @@
 
 static int ticks = 0;
 
-static Uint32 ticktock(Uint32 interval)
+static Uint32 SDLCALL ticktock(Uint32 interval)
 {
 	++ticks;
 	return(interval);
 }
 
-static Uint32 callback(Uint32 interval, void *param)
+static Uint32 SDLCALL callback(Uint32 interval, void *param)
 {
   printf("Timer %d : param = %d\n", interval, (int)(uintptr_t)param);
   return interval;
--- a/test/testwm.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/testwm.c	Sun May 07 03:40:06 2006 +0000
@@ -168,7 +168,7 @@
 	SDL_PushEvent(&event);
 }
 
-int FilterEvents(const SDL_Event *event)
+int SDLCALL FilterEvents(const SDL_Event *event)
 {
 	static int reallyquit = 0;
 
--- a/test/threadwin.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/threadwin.c	Sun May 07 03:40:06 2006 +0000
@@ -77,7 +77,7 @@
 	return(icon);
 }
 
-int FilterEvents(const SDL_Event *event)
+int SDLCALL FilterEvents(const SDL_Event *event)
 {
 	static int reallyquit = 0;
 
@@ -127,7 +127,7 @@
 	}
 }
 
-int HandleMouse(void *unused)
+int SDLCALL HandleMouse(void *unused)
 {
 	SDL_Event events[10];
 	int i, found;
@@ -164,7 +164,7 @@
 	return(0);
 }
 
-int HandleKeyboard(void *unused)
+int SDLCALL HandleKeyboard(void *unused)
 {
 	SDL_Event events[10];
 	int i, found;
--- a/test/torturethread.c	Fri May 05 05:50:26 2006 +0000
+++ b/test/torturethread.c	Sun May 07 03:40:06 2006 +0000
@@ -20,14 +20,14 @@
 	exit(rc);
 }
 
-int SubThreadFunc(void *data) {
+int SDLCALL SubThreadFunc(void *data) {
 	while(! *(int volatile *)data) {
 		; /*SDL_Delay(10);*/  /* do nothing */
 	}
 	return 0;
 }
 
-int ThreadFunc(void *data) {
+int SDLCALL ThreadFunc(void *data) {
 	SDL_Thread *sub_threads[NUMTHREADS];
 	int flags[NUMTHREADS];
 	int i;