We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1598 - Mingwin build fails on src/audio/xaudio2/SDL_xaudio2.c
Summary: Mingwin build fails on src/audio/xaudio2/SDL_xaudio2.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 2.0
Hardware: x86 Windows (All)
: P2 blocker
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-10 02:04 UTC by Paulo Assis
Modified: 2015-02-18 04:33 UTC (History)
0 users

See Also:


Attachments
patch to enable mingwin build of SDL 2.0 (1.50 KB, patch)
2012-09-10 02:04 UTC, Paulo Assis
Details | Diff
a second version fix for the mingwin build (1.13 KB, patch)
2013-07-05 06:25 UTC, Paulo Assis
Details | Diff
a version 3 of the patch (870 bytes, patch)
2013-07-05 06:40 UTC, Paulo Assis
Details | Diff
check for gnuc before redefining THIS_ (937 bytes, patch)
2013-07-05 06:55 UTC, Paulo Assis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Assis 2012-09-10 02:04:42 UTC
Created attachment 947 [details]
patch to enable mingwin build of SDL 2.0

When building SDL2.0 on mingwin the build process fails on the above file.
By using the attached patch I was able to successfully complete the build. 
Since I don't use any of those functions in my projects, I was not able to test if the patch breaks any functionality, but at least it enables the build process to finish.
Comment 1 Ryan C. Gordon 2013-07-04 23:53:31 UTC
This patch wouldn't work, since it removes the "this" pointer that XAudio2 expects to pass to the callback.

Is the problem that MingW's headers don't have that awful "THIS_" macro? My MingW install doesn't find XAudio2 headers at all, so it never tries to build this code, so I can't tell what the specific problem was.

--ryan.
Comment 2 Paulo Assis 2013-07-05 06:25:15 UTC
Created attachment 1208 [details]
a second version fix for the mingwin build
Comment 3 Paulo Assis 2013-07-05 06:31:12 UTC
This is what i get with the current code:

/bin/sh ./libtool --mode=compile gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude -I../include  -mmmx
 -m3dnow -msse -mpreferred-stack-boundary=2 -Wall -MMD -MT build/SDL_xaudio2.lo -c ../src/audio/xaud
io2/SDL_xaudio2.c -o build/SDL_xaudio2.lo
libtool: compile:  gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude -I../include -mmmx -m3dnow -msse
-mpreferred-stack-boundary=2 -Wall -MMD -MT build/SDL_xaudio2.lo -c ../src/audio/xaudio2/SDL_xaudio2
.c  -DDLL_EXPORT -DPIC -o build/.libs/SDL_xaudio2.o
../src/audio/xaudio2/SDL_xaudio2.c: In function 'XAUDIO2_DetectDevices':
../src/audio/xaudio2/SDL_xaudio2.c:72:11: warning: unused variable 'ptr' [-Wunused-variable]
../src/audio/xaudio2/SDL_xaudio2.c: In function 'VoiceCBOnVoiceError':
../src/audio/xaudio2/SDL_xaudio2.c:109:1: error: parameter name omitted
../src/audio/xaudio2/SDL_xaudio2.c: In function 'VoiceCBOnStreamEnd':
../src/audio/xaudio2/SDL_xaudio2.c:116:1: error: parameter name omitted
../src/audio/xaudio2/SDL_xaudio2.c: In function VoiceCBOnVoiceProcessPassStart':
../src/audio/xaudio2/SDL_xaudio2.c:117:1: error: parameter name omitted
../src/audio/xaudio2/SDL_xaudio2.c: In function 'VoiceCBOnVoiceProcessPassEnd':
../src/audio/xaudio2/SDL_xaudio2.c:118:1: error: parameter name omitted
../src/audio/xaudio2/SDL_xaudio2.c: In function 'VoiceCBOnBufferStart':
../src/audio/xaudio2/SDL_xaudio2.c:119:1: error: parameter name omitted
../src/audio/xaudio2/SDL_xaudio2.c: In function 'VoiceCBOnLoopEnd':
../src/audio/xaudio2/SDL_xaudio2.c:120:1: error: parameter name omitted
../src/audio/xaudio2/SDL_xaudio2.c: In function 'XAUDIO2_OpenDevice':
../src/audio/xaudio2/SDL_xaudio2.c:240:9: warning: initialization from incompatible pointer type [enabled by default]
../src/audio/xaudio2/SDL_xaudio2.c:240:9: warning: (near initialization for 'callbacks_vtable.OnBufferEnd') [enabled by default]
make: *** [build/SDL_xaudio2.lo] Error 1

the THIS_ and THIS macros are defined in basetyps.h:

#  define THIS_	INTERFACE *,
#  define THIS	INTERFACE *

so the problem is that gcc does not accept passing an argument without setting its name.

so simply redefining THIS_ like:
#  define THIS_	INTERFACE *p,

and adding an arg name after THIS macro fixes it for me.

See second version of the patch.

Regards,
Paulo
Comment 4 Paulo Assis 2013-07-05 06:40:54 UTC
Created attachment 1209 [details]
a version 3 of the patch

redefine THIS_ earlier so that it can also be used in VoiceCBOnBufferEnd
Comment 5 Paulo Assis 2013-07-05 06:55:17 UTC
Created attachment 1210 [details]
check for gnuc before redefining THIS_

We probably want to check if gcc is being used (or even for mingw ?)
Don't really use windows much so I sometimes forget there are other compilers out there ;D
Comment 6 Sam Lantinga 2013-10-18 06:15:56 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/722c44cad199
Comment 7 Ryan C. Gordon 2015-02-18 04:33:32 UTC
I think we forgot to mark this bug as FIXED.

--ryan.