dynapi: Accept a comma-separated list of libraries to attempt to load.
First one to load and have the necessary symbol is the one we accept, if any. Once we accept one, we won't try loading others. Fixes #7613. (cherry picked from commit 32999798e0232cdeda777a32ce2fe6b78ec2bb4e)
This commit is contained in:
parent
68edc72ae8
commit
d05639a626
@ -434,14 +434,28 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
|
|||||||
|
|
||||||
static void SDL_InitDynamicAPILocked(void)
|
static void SDL_InitDynamicAPILocked(void)
|
||||||
{
|
{
|
||||||
const char *libname = SDL_getenv_REAL(SDL_DYNAMIC_API_ENVVAR);
|
char *libname = SDL_getenv_REAL(SDL_DYNAMIC_API_ENVVAR);
|
||||||
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
|
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
|
||||||
SDL_bool use_internal = SDL_TRUE;
|
SDL_bool use_internal = SDL_TRUE;
|
||||||
|
|
||||||
if (libname) {
|
if (libname) {
|
||||||
entry = (SDL_DYNAPI_ENTRYFN)get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
|
while (*libname && !entry) {
|
||||||
|
char *ptr = libname;
|
||||||
|
while (SDL_TRUE) {
|
||||||
|
const char ch = *ptr;
|
||||||
|
if ((ch == ',') || (ch == '\0')) {
|
||||||
|
*ptr = '\0';
|
||||||
|
entry = (SDL_DYNAPI_ENTRYFN)get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
|
||||||
|
*ptr = ch;
|
||||||
|
libname = (ch == '\0') ? ptr : (ptr + 1);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
dynapi_warn("Couldn't load overriding SDL library. Please fix or remove the " SDL_DYNAMIC_API_ENVVAR " environment variable. Using the default SDL.");
|
dynapi_warn("Couldn't load an overriding SDL library. Please fix or remove the " SDL_DYNAMIC_API_ENVVAR " environment variable. Using the default SDL.");
|
||||||
/* Just fill in the function pointers from this library, later. */
|
/* Just fill in the function pointers from this library, later. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user