Skip to content

Commit 75172d2

Browse files
committed
Fixed bug #943
Ozkan Sezer 2010-02-06 12:31:06 PST Hi: Here are some small fixes for compiling SDL against mingw-w64. (see http://mingw-w64.sourceforge.net/ . Despite the name, it supports both win32 and win64.) Two patches, one for SDL-1.2 and one for SDL-1.3 attached. src/audio/windx5/directx.h and src/video/windx5/directx.h (both SDL-1.2 and SDL-1.3.) I get compilation errors about some union not having a member named u1 and alike, because of other system headers being included before this one and them already defining DUMMYUNIONNAME and stuff. This header probably assumes that those stuff are defined in windef.h, but mingw-w64 headers define them in _mingw.h. Easily fixed by moving NONAMELESSUNION definition to the top of the file. SDL_dx5yuv.c (SDL-1.2-only) also needs to include the header before SDL_video.h to avoid the same problem. src/thread/win32/SDL_systhread.c (both SDL-1.2 and SDL-1.3.) : The __GNUC__ case for pfnSDL_CurrentBeginThread is 32-bit centric because _beginthreadex returns uintptr_t, not unsigned long which is 32 bits in win64. Changing the return type to uintptr_t fixes it. Hope these are useful. Thanks.
1 parent 252f9f8 commit 75172d2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/audio/windx5/directx.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#ifndef _directx_h
33
#define _directx_h
44

5+
#ifdef __GNUC__
6+
#define NONAMELESSUNION
7+
#endif
8+
59
/* Include all of the DirectX 5.0 headers and adds any necessary tweaks */
610

711
#define WIN32_LEAN_AND_MEAN
@@ -74,9 +78,6 @@
7478
#define DIRECTSOUND_VERSION 0x0500
7579
#define DIRECTINPUT_VERSION 0x0500
7680

77-
#ifdef __GNUC__
78-
#define NONAMELESSUNION
79-
#endif
8081
#include <ddraw.h>
8182
#include <dsound.h>
8283
#include <dinput.h>

src/thread/win32/SDL_systhread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#endif
3838

3939
#if __GNUC__
40-
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
40+
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
4141
unsigned (__stdcall *func)(void *), void *arg,
4242
unsigned, unsigned *threadID);
4343
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);

src/video/windx5/SDL_dx5yuv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "SDL_config.h"
2323

2424
/* This is the DirectDraw implementation of YUV video overlays */
25-
25+
#include "directx.h"
2626
#include "SDL_video.h"
2727
#include "SDL_dx5yuv_c.h"
2828
#include "../SDL_yuvfuncs.h"

src/video/windx5/directx.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#ifndef _directx_h
33
#define _directx_h
44

5+
#ifdef __GNUC__
6+
#define NONAMELESSUNION
7+
#endif
8+
59
/* Include all of the DirectX 5.0 headers and adds any necessary tweaks */
610

711
#define WIN32_LEAN_AND_MEAN
@@ -74,9 +78,6 @@
7478
#define DIRECTSOUND_VERSION 0x0500
7579
#define DIRECTINPUT_VERSION 0x0700
7680

77-
#ifdef __GNUC__
78-
#define NONAMELESSUNION
79-
#endif
8081
#include <ddraw.h>
8182
#include <dsound.h>
8283
#include <dinput.h>

0 commit comments

Comments
 (0)