Don't define lib handles when dynamic loading is disabled
This commit is contained in:
+3
-5
@@ -32,8 +32,8 @@
|
||||
static const ALCchar alsaDevice[] = "ALSA Default";
|
||||
|
||||
|
||||
static void *alsa_handle;
|
||||
#ifdef HAVE_DYNLOAD
|
||||
static void *alsa_handle;
|
||||
#define MAKE_FUNC(f) static typeof(f) * p##f
|
||||
MAKE_FUNC(snd_strerror);
|
||||
MAKE_FUNC(snd_pcm_open);
|
||||
@@ -172,9 +172,9 @@ MAKE_FUNC(snd_card_next);
|
||||
|
||||
static ALCboolean alsa_load(void)
|
||||
{
|
||||
#ifdef HAVE_DYNLOAD
|
||||
if(!alsa_handle)
|
||||
{
|
||||
#ifdef HAVE_DYNLOAD
|
||||
alsa_handle = LoadLib("libasound.so.2");
|
||||
if(!alsa_handle)
|
||||
return ALC_FALSE;
|
||||
@@ -253,10 +253,8 @@ static ALCboolean alsa_load(void)
|
||||
LOAD_FUNC(snd_ctl_card_info_get_id);
|
||||
LOAD_FUNC(snd_card_next);
|
||||
#undef LOAD_FUNC
|
||||
#else
|
||||
alsa_handle = (void*)0xDEADBEEF;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return ALC_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
static const ALCchar pa_device[] = "PortAudio Default";
|
||||
|
||||
|
||||
static void *pa_handle;
|
||||
#ifdef HAVE_DYNLOAD
|
||||
static void *pa_handle;
|
||||
#define MAKE_FUNC(x) static typeof(x) * p##x
|
||||
MAKE_FUNC(Pa_Initialize);
|
||||
MAKE_FUNC(Pa_Terminate);
|
||||
@@ -60,11 +60,11 @@ MAKE_FUNC(Pa_GetStreamInfo);
|
||||
|
||||
static ALCboolean pa_load(void)
|
||||
{
|
||||
if(!pa_handle)
|
||||
{
|
||||
PaError err;
|
||||
PaError err;
|
||||
|
||||
#ifdef HAVE_DYNLOAD
|
||||
if(!pa_handle)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
# define PALIB "portaudio.dll"
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
@@ -98,9 +98,6 @@ static ALCboolean pa_load(void)
|
||||
LOAD_FUNC(Pa_GetDefaultOutputDevice);
|
||||
LOAD_FUNC(Pa_GetStreamInfo);
|
||||
#undef LOAD_FUNC
|
||||
#else
|
||||
pa_handle = (void*)0xDEADBEEF;
|
||||
#endif
|
||||
|
||||
if((err=Pa_Initialize()) != paNoError)
|
||||
{
|
||||
@@ -110,6 +107,13 @@ static ALCboolean pa_load(void)
|
||||
return ALC_FALSE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if((err=Pa_Initialize()) != paNoError)
|
||||
{
|
||||
ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
|
||||
return ALC_FALSE;
|
||||
}
|
||||
#endif
|
||||
return ALC_TRUE;
|
||||
}
|
||||
|
||||
@@ -424,14 +428,16 @@ ALCboolean alc_pa_init(BackendFuncs *func_list)
|
||||
|
||||
void alc_pa_deinit(void)
|
||||
{
|
||||
#ifdef HAVE_DYNLOAD
|
||||
if(pa_handle)
|
||||
{
|
||||
Pa_Terminate();
|
||||
#ifdef HAVE_DYNLOAD
|
||||
CloseLib(pa_handle);
|
||||
#endif
|
||||
pa_handle = NULL;
|
||||
}
|
||||
#else
|
||||
Pa_Terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
void alc_pa_probe(enum DevProbe type)
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
(PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro)))
|
||||
#endif
|
||||
|
||||
static void *pa_handle;
|
||||
#ifdef HAVE_DYNLOAD
|
||||
static void *pa_handle;
|
||||
#define MAKE_FUNC(x) static typeof(x) * p##x
|
||||
MAKE_FUNC(pa_context_unref);
|
||||
MAKE_FUNC(pa_sample_spec_valid);
|
||||
@@ -273,10 +273,9 @@ static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent)
|
||||
static ALCboolean pulse_load(void) //{{{
|
||||
{
|
||||
ALCboolean ret = ALC_TRUE;
|
||||
#ifdef HAVE_DYNLOAD
|
||||
if(!pa_handle)
|
||||
{
|
||||
#ifdef HAVE_DYNLOAD
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PALIB "libpulse-0.dll"
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
@@ -366,18 +365,13 @@ static ALCboolean pulse_load(void) //{{{
|
||||
#endif
|
||||
#undef LOAD_OPTIONAL_FUNC
|
||||
|
||||
#else /* HAVE_DYNLOAD */
|
||||
pa_handle = (void*)0xDEADBEEF;
|
||||
#endif
|
||||
|
||||
if(ret == ALC_FALSE)
|
||||
{
|
||||
#ifdef HAVE_DYNLOAD
|
||||
CloseLib(pa_handle);
|
||||
#endif
|
||||
pa_handle = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_DYNLOAD */
|
||||
return ret;
|
||||
} //}}}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
static const ALCchar sndio_device[] = "SndIO Default";
|
||||
|
||||
|
||||
static void *sndio_handle;
|
||||
#ifdef HAVE_DYNLOAD
|
||||
static void *sndio_handle;
|
||||
#define MAKE_FUNC(x) static typeof(x) * p##x
|
||||
MAKE_FUNC(sio_initpar);
|
||||
MAKE_FUNC(sio_open);
|
||||
@@ -76,9 +76,9 @@ MAKE_FUNC(sio_onvol);
|
||||
|
||||
static ALCboolean sndio_load(void)
|
||||
{
|
||||
#ifdef HAVE_DYNLOAD
|
||||
if(!sndio_handle)
|
||||
{
|
||||
#ifdef HAVE_DYNLOAD
|
||||
sndio_handle = LoadLib("libsndio.so");
|
||||
if(!sndio_handle)
|
||||
return ALC_FALSE;
|
||||
@@ -109,10 +109,8 @@ static ALCboolean sndio_load(void)
|
||||
LOAD_FUNC(sio_setvol);
|
||||
LOAD_FUNC(sio_onvol);
|
||||
#undef LOAD_FUNC
|
||||
#else
|
||||
sndio_handle = (void*)0xDEADBEEF;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return ALC_TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user