OS/2: proper fix for dynapi (thanks, Ozkan!).

This commit is contained in:
Ryan C. Gordon 2017-08-25 11:31:12 -04:00
parent 685890a229
commit 2213077a95
1 changed files with 7 additions and 4 deletions

View File

@ -24,6 +24,12 @@
#if SDL_DYNAMIC_API #if SDL_DYNAMIC_API
#if defined(__OS2__)
#define INCL_DOS
#define INCL_DOSERRORS
#include <dos.h>
#endif
#include "SDL.h" #include "SDL.h"
/* !!! FIXME: Shouldn't these be included in SDL.h? */ /* !!! FIXME: Shouldn't these be included in SDL.h? */
@ -232,16 +238,13 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
} }
#elif defined(__OS2__) #elif defined(__OS2__)
#define INCL_DOS
#define INCL_DOSERRORS
#include <dos.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{ {
HMODULE hmodule; HMODULE hmodule;
PFN retval = NULL; PFN retval = NULL;
char error[256]; char error[256];
if (NO_ERROR == DosLoadModule(&error, sizeof(error), fname, &hmodule)) { if (NO_ERROR == DosLoadModule(&error, sizeof(error), fname, &hmodule)) {
if (NO_ERROR == DosQueryProcAddr(handle, 0, sym, &retval)) { if (NO_ERROR == DosQueryProcAddr(hmodule, 0, sym, &retval)) {
DosFreeModule(hmodule); DosFreeModule(hmodule);
} }
} }