hello everyone,
i am using the gnu g++ compiler on windows xp.
i have had some success building the 3d and stream examples.
i am now giving the dsp samples a whirl.
everything compiles and runs just fine in vs.
when i try to use g++ i get this error:

[code:3gallukk]D:\workspace\dsp>g++ -c -g Main.cpp -I"D:\fmodapi371win32\api\inc"
Main.cpp: In function void SetupReverb()':
Main.cpp:235: invalid conversion from
void()(void*, void*, int, int)’ to `
void()(void*, void*, int, int)'[/code:3gallukk]

which is this line of code in the source:
[code:3gallukk] DSP_ReverbTap[count].Unit = FSOUND_DSP_Create(&DSP_ReverbCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+20+(count*2),(int)&DSP_ReverbTap[count]);[/code:3gallukk]

it seems like somehow the signature has a return at its start.
any idea what is going on?

i have also tried the stream2 example and g++ fails with same error on the same function.

my version:
[code:3gallukk]D:\workspace\dsp>g++ -v
Reading specs from C:/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/specs
Configured with: ../gcc/configure –with-gcc –with-gnu-ld –with-gnu-as –host=
mingw32 –target=mingw32 –prefix=/mingw –enable-threads –disable-nls –enable
-languages=c++,f77,objc –disable-win32-registry –disable-shared –enable-sjlj-
Thread model: win32
gcc version 3.2.3 (mingw special 20030504-1)[/code:3gallukk]



  • You must to post comments

sadly that doesnt make any difference to the error.
any other ideas?

is there another way to achieve the effect using a different function?

i can confirm that

[code:3ham7vw2]dsp1 = FSOUND_Stream_CreateDSP(stream, dspcallback, 0, 0);[/code:3ham7vw2]

generates the same error.

interestly if i pass NULL as the dspcallback it manages to compile.
but obviously this doesnt get me a callback…
i also tried to cast the function pointer to its signature using

[code:3ham7vw2]DSP_ReverbTap[count].Unit = FSOUND_DSP_Create(
(void* () (void, void*, int, int)) &DSP_ReverbCallback, 0,0)[/code:3ham7vw2]

but this generates the same error again.

if cast it using the callback typedef from fmod.h it compiles… but then the app crashes …

i wonder what is going on…

  • You must to post comments

i agree.
i have found a bug in gcc where the calling convension is ommitted from the error message.
could it be that this obtuse error message is trying to say that the calling convensions are somehow mismatching. Is it possible that something is needed in fmod.h or my compiler arguements to match the calling versions. Its seems especially strange that i can get the examples to compile with a cast to the fmod.h defined type:

[code:39wgcg8x]dsp1 = FSOUND_Stream_CreateDSP(stream, (FSOUND_DSPCALLBACK) dspcallback, 0, 0); [/code:39wgcg8x]

the exe will run but crash when you hit a key start dsp unit 2. if the signatures to the functions are the same why should the cast make any difference at all and why later? surely there are other people using fmod, gcc and windows out there?

  • You must to post comments

[code:j1m0hmnt]D:\workspace\stream2>g++ -v
Using builtin specs.
gcc version 2.95.2 19991024 (release)[/code:j1m0hmnt]

with this version of gcc that comes with dev-cpp it compiles and runs fine.
so there is something to do with function pointers in fmod that the lastest mingw gcc cant handle.
for now i think i will use the one that works. 😀

  • You must to post comments

Hey pickledonion,
I solved my & your problem: try to install gcc 3.4…it compiles very good!

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.