- Support loading either fluidsynth.dll or libfluidsynth.dll on Windows.

SVN r3927 (trunk)
This commit is contained in:
Randy Heit 2012-11-01 03:01:04 +00:00
parent bfae51ed2e
commit 4f71176ed6

View file

@ -50,9 +50,11 @@
#ifdef _WIN32
#ifndef _M_X64
#define FLUIDSYNTHLIB "fluidsynth.dll"
#define FLUIDSYNTHLIB1 "fluidsynth.dll"
#define FLUIDSYNTHLIB2 "libfluidsynth.dll"
#else
#define FLUIDSYNTHLIB "fluidsynth64.dll"
#define FLUIDSYNTHLIB1 "fluidsynth64.dll"
#define FLUIDSYNTHLIB2 "libfluidsynth64.dll"
#endif
#else
#include <dlfcn.h>
@ -665,16 +667,21 @@ bool FluidSynthMIDIDevice::LoadFluidSynth()
{ (void **)&fluid_synth_sysex, "fluid_synth_sysex" },
};
int fail = 0;
const char *libname;
#ifdef _WIN32
FluidSynthDLL = LoadLibrary(FLUIDSYNTHLIB);
FluidSynthDLL = LoadLibrary((libname = FLUIDSYNTHLIB1));
if (FluidSynthDLL == NULL)
{
Printf(TEXTCOLOR_RED"Could not load " FLUIDSYNTHLIB "\n");
FluidSynthDLL = LoadLibrary((libname = FLUIDSYNTHLIB2));
if (FluidSynthDLL == NULL)
{
Printf(TEXTCOLOR_RED"Could not load " FLUIDSYNTHLIB1 " or " FLUIDSYNTHLIB2 "\n");
return false;
}
}
#else
FluidSynthSO = dlopen(FLUIDSYNTHLIB, RTLD_LAZY);
FluidSynthSO = dlopen((libname = FLUIDSYNTHLIB), RTLD_LAZY);
if (FluidSynthSO == NULL)
{
Printf(TEXTCOLOR_RED"Could not load " FLUIDSYNTHLIB ": %s\n", dlerror());
@ -691,7 +698,7 @@ bool FluidSynthMIDIDevice::LoadFluidSynth()
#endif
if (proc == NULL)
{
Printf(TEXTCOLOR_RED"Failed to find %s in %s\n", imports[i].FuncName, FLUIDSYNTHLIB);
Printf(TEXTCOLOR_RED"Failed to find %s in %s\n", imports[i].FuncName, libname);
fail++;
}
*imports[i].FuncPointer = (void *)proc;