Using SDL-mixer in Haskell

I had tried to use SDL-mixer in Haskell several times, but always I hit the wall.
Today, I found a good tutorial for SDL-mixer in C: SDL_Mixer Tutorial, and I try same sequence in Haskell again.
But unfortunately, I've got some error.

$ ghc --make sdl-mixer-test2.hs
Linking sdl-mixer-test2 ...
/home/foo/.cabal/lib/SDL-mixer-0.5.2/ghc-6.8.2/libHSSDL-mixer-0.5.2.a(Samples.o): In function `s5wy_info':
(.text+0x25d): undefined reference to `Mix_LoadWAV'
collect2: ld はステータス 1 で終了しました

It said, undefined reference to `Mix_LoadWAV'. In /usr/local/include/SDL/SDL_mixer.h,

#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1)

There are no function body. Maybe it has changed something.
So I update SDL-mixer and SDL to 0.5.5, and try again, then got it!

Here are sample in Haskell, like original C version:

1 comment:

Anonymous said...

I just tried your code with SDL-mixer 0.6.1 and it's not working. Do you think you could review it and see what may be happening?