comparison src/audio/alsa/SDL_alsa_audio.c @ 939:c7c04f811994

Date: Tue, 01 Jun 2004 15:27:44 +0300 From: Martin_Storsj Subject: Update for dynamic loading of ALSA I sent you a patch a few months ago which enables SDL to load ALSA dynamically. Now I've finally got time to tweak this yet some more. I've added code from alsa.m4 (from alsa's dev package) to acinclude.m4, and made the detection of the alsa library name a bit better. I've also fixed up the loading versioned symbols with dlvsym, so that it falls back to dlsym. I wouldn't say the configure script is complete yet, but this is how far I've come this time, and I'm no expert at those things.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 21 Aug 2004 04:20:00 +0000
parents 92615154bb68
children 41a59de7f2ed
comparison
equal deleted inserted replaced
938:fa2ce068b0b6 939:c7c04f811994
40 #include "SDL_audio_c.h" 40 #include "SDL_audio_c.h"
41 #include "SDL_timer.h" 41 #include "SDL_timer.h"
42 #include "SDL_alsa_audio.h" 42 #include "SDL_alsa_audio.h"
43 43
44 #ifdef ALSA_DYNAMIC 44 #ifdef ALSA_DYNAMIC
45 #ifdef USE_DLVSYM
45 #define __USE_GNU 46 #define __USE_GNU
47 #endif
46 #include <dlfcn.h> 48 #include <dlfcn.h>
47 #include "SDL_name.h" 49 #include "SDL_name.h"
48 #include "SDL_loadso.h" 50 #include "SDL_loadso.h"
49 #else 51 #else
50 #define SDL_NAME(X) X 52 #define SDL_NAME(X) X
132 if (alsa_handle) { 134 if (alsa_handle) {
133 alsa_loaded = 1; 135 alsa_loaded = 1;
134 retval = 0; 136 retval = 0;
135 for (i = 0; i < SDL_TABLESIZE(alsa_functions); i++) { 137 for (i = 0; i < SDL_TABLESIZE(alsa_functions); i++) {
136 /* *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/ 138 /* *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/
139 #ifdef USE_DLVSYM
137 *alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9"); 140 *alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9");
141 if (!*alsa_functions[i].func)
142 #endif
143 *alsa_functions[i].func = dlsym(alsa_handle,alsa_functions[i].name);
138 if (!*alsa_functions[i].func) { 144 if (!*alsa_functions[i].func) {
139 retval = -1; 145 retval = -1;
140 UnloadALSALibrary(); 146 UnloadALSALibrary();
141 break; 147 break;
142 } 148 }