Skip to content

Commit 63bb1a8

Browse files
committed
dynapi: use DosScanEnv() for os/2.
(cherry picked from commit ee49025)
1 parent 8b0c9e1 commit 63bb1a8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/dynapi/SDL_dynapi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,19 +440,24 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode);
440440

441441
static void SDL_InitDynamicAPILocked(void)
442442
{
443+
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
444+
SDL_bool use_internal = SDL_TRUE;
445+
443446
/* this can't use SDL_getenv_REAL, because it might allocate memory before the app can set their allocator */
444447
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
445448
/* We've always used LoadLibraryA for this, so this has never worked with Unicode paths on Windows. Sorry. */
446449
char envbuf[512]; /* overflows will just report as environment variable being unset, but LoadLibraryA has a MAX_PATH of 260 anyhow, apparently. */
447450
const DWORD rc = GetEnvironmentVariableA(SDL_DYNAMIC_API_ENVVAR, envbuf, (DWORD) sizeof (envbuf));
448451
char *libname = ((rc != 0) && (rc < sizeof (envbuf))) ? envbuf : NULL;
452+
#elif defined(__OS2__)
453+
char * libname;
454+
if (DosScanEnv(SDL_DYNAMIC_API_ENVVAR, &libname) != NO_ERROR) {
455+
libname = NULL;
456+
}
449457
#else
450458
char *libname = getenv(SDL_DYNAMIC_API_ENVVAR);
451459
#endif
452460

453-
SDL_DYNAPI_ENTRYFN entry = NULL; /* funcs from here by default. */
454-
SDL_bool use_internal = SDL_TRUE;
455-
456461
if (libname) {
457462
while (*libname && !entry) {
458463
char *ptr = libname;

0 commit comments

Comments
 (0)