From ea76ba03a7e678510ad416ee2e8d14ea7116d6c2 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 10 Jun 2023 20:55:50 +0300
Subject: [PATCH] dynapi: update from SDL2 to accept a comma-separated list of
libraries to attempt to load
---
src/dynapi/SDL_dynapi.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c
index e5e6a35..72a56db 100644
--- a/src/dynapi/SDL_dynapi.c
+++ b/src/dynapi/SDL_dynapi.c
@@ -449,9 +449,23 @@ static void SDL_InitDynamicAPILocked(void)
SDL_bool use_internal = SDL_TRUE;
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) {
- 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. */
}
}