Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
The #define was asking to use dlopen(), but the code wasn't doing it.
Also added error message in case the library open failed in that case.
  • Loading branch information
slouken committed Jan 8, 2012
1 parent 939c9e0 commit 1470f3d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/video/x11/SDL_x11opengl.c
Expand Up @@ -82,8 +82,8 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy,
*attrib_list);
#endif

#define OPENGL_REQUIRS_DLOPEN
#if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
#define OPENGL_REQUIRES_DLOPEN
#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
#include <dlfcn.h>
#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
#define GL_LoadFunction dlsym
Expand All @@ -109,8 +109,11 @@ X11_GL_LoadLibrary(_THIS, const char *path)
if (path == NULL) {
path = DEFAULT_OPENGL;
}
_this->gl_config.dll_handle = SDL_LoadObject(path);
_this->gl_config.dll_handle = GL_LoadObject(path);
if (!_this->gl_config.dll_handle) {
#if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
SDL_SetError("Failed loading %s: %s", path, dlerror());
#endif
return -1;
}
SDL_strlcpy(_this->gl_config.driver_path, path,
Expand Down

0 comments on commit 1470f3d

Please sign in to comment.