From a3890ff6d7a1f1ca517de2719f0726235035cb19 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 22 Aug 2017 15:50:39 -0400 Subject: [PATCH] dynapi: fill in OS/2 loading code (thanks, Ozkan!). Partially fixes Bugzilla #3765. --- src/dynapi/SDL_dynapi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index c0051e9b50220..efb572803817e 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -230,6 +230,24 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) } return retval; } + +#elif defined(__OS2__) +#define INCL_DOS +#define INCL_DOSERRORS +#include +static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) +{ + HMODULE hmodule; + PFN retval = NULL; + char error[256]; + if (NO_ERROR == DosLoadModule(&error, sizeof(error), fname, &hmodule)) { + if (NO_ERROR == DosQueryProcAddr(handle, 0, sym, &retval)) { + DosFreeModule(hmodule); + } + } + return (void *) retval; +} + #else #error Please define your platform. #endif