# HG changeset patch # User Ryan C. Gordon # Date 1160205832 0 # Node ID 25052dd2581099ed6d8cf2080c76f8ed64dedaa1 # Parent c562b1a12f82ea4195ecfd8756f32b8472d1ccba Minor ALSA dynamic loading fix. diff -r c562b1a12f82 -r 25052dd25810 src/audio/alsa/SDL_alsa_audio.c --- a/src/audio/alsa/SDL_alsa_audio.c Sat Oct 07 06:18:15 2006 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Sat Oct 07 07:23:52 2006 +0000 @@ -90,6 +90,12 @@ static int load_alsa_sym(const char *fn, void **addr) { + /* + * !!! FIXME: + * Eventually, this will deal with fallbacks, version changes, and + * missing symbols we can workaround. But for now, it doesn't. + */ + #if HAVE_DLVSYM *addr = dlvsym(alsa_handle, fn, "ALSA_0.9"); if (*addr == NULL) @@ -97,6 +103,7 @@ { *addr = dlsym(alsa_handle, fn); if (*addr == NULL) { + SDL_SetError("dlsym('%s') failed: %s", fn, strerror(errno)); return 0; } } @@ -140,6 +147,7 @@ SDL_ALSA_SYM(snd_pcm_nonblock); return 0; } +#undef SDL_ALSA_SYM #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC @@ -377,6 +385,7 @@ } SDL_free(this->hidden); this->hidden = NULL; + UnloadALSALibrary(); } } @@ -400,6 +409,11 @@ } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); + if (LoadALSALibrary() < 0) { + ALSA_CloseDevice(this); + return 0; + } + /* Open the audio device */ /* Name of device should depend on # channels in spec */ status = ALSA_snd_pcm_open(&pcm_handle,