Hi. I use Linux (Debian 6) and have tried this with both Allegro 4.2 and Allegro 4.4. In the following description, "the library" stands for either one of those.
I have compiled the library both as a shared lib and a statically linked lib. When I link with $(allegro-config --libs), the shared one gets used. When I link with $(allegro-config --libs --static), the static lib gets used, as intended.
I initialize the sound with install_sound(DIGI_AUTODETECT, MIDI_NONE, 0) and later play back samples. When I link dynamically, everything works, the call to install_sound returns 0 as expected, and I hear samples being played. When I link statically, however, I get no sound at all, even though the call still returns 0.
I have tried DIGI_ALSA, which doesn't change anything: In both cases, the call returns 0, but I get sound only when linking dynamically.
(If necessary, I can throw together a full test program, but it's basically this call, a sample load, and a playback.)
Anyone have an idea why I lack sound when linking statically, or what I could try? (I found this exact problem in one or two threads on the internet, but nobody had a solution there; the forums weren't Allegro-related though.)
On my system, $(allegro-config --libs --static) expands to -L/usr/lib -lalleg -lm -lXxf86vm -lXcursor -lXpm -lXext -lX11 -lpthread -ldl, and I get no linker errors.