From 0754901ca93b7d6814c021706a69024f5da3e461 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Jul 2013 03:44:03 -0700 Subject: [PATCH] Fixed bug 1983 - SDL_thread.h broken under MinGW crosscompiling environment q66 after updating SDL2 to the latest RC I'm unable to build my game engine under mingw crosscompiling environment for Windows (32bit, hosted on freebsd 64bit). The error is in SDL_thread.h with messages like this: http://codepad.org/jEQXd3Yq The problem is, while _beginthreadex return type is correctly mapped to uintptr_t (as specified by Microsoft), the return type under mingw is unsigned long int (same size, different signature), resulting in the error above. The reason it didn't error before is this: http://codepad.org/8FAbKAxz You can see the _beginthreadex case is only used without HAVE_LIBC defined; at one point though, SDL_config_windows.h was changed like this: -/* Enabled for SDL 1.2 (binary compatibility) */ -#define HAVE_LIBC 1 +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ resulting in these errors. --- include/SDL_thread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL_thread.h b/include/SDL_thread.h index e480a773b..c878c3ab9 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -109,7 +109,7 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, /** * Create a thread. */ -#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, _beginthreadex, _endthreadex) +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else