diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2017-02-03 16:13:45 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2017-02-03 16:13:45 +0000 |
commit | 30b8a4cd2d115eab93ca39709c956f48aa8dadbe (patch) | |
tree | c1a5ed257816b74282485603122a517ca403035c | |
parent | acdd6d8bf88a5381800affaaf59fd4c5300b6cd6 (diff) | |
download | libepoxy-30b8a4cd2d115eab93ca39709c956f48aa8dadbe.tar.gz |
Add conservative functions for checking platform symbols
When checking whether GLX or EGL are available on the system, we don't
want to use the internal API that forces an exit() on missing libraries
and symbols — as that would defeat the point.
Instead, we should have safe functions to call internally that simply
return a NULL pointer, so we can bail out ourselves in a controlled
fashion.
-rw-r--r-- | src/dispatch_common.c | 16 | ||||
-rw-r--r-- | src/dispatch_common.h | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c index 17d0c5e..b521b1b 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -569,15 +569,27 @@ epoxy_conservative_has_gl_extension(const char *ext) } void * +epoxy_conservative_egl_dlsym(const char *name, bool exit_if_fails) +{ + return do_dlsym(&api.egl_handle, EGL_LIB, name, exit_if_fails); +} + +void * epoxy_egl_dlsym(const char *name) { - return do_dlsym(&api.egl_handle, EGL_LIB, name, true); + return epoxy_conservative_egl_dlsym(name, true); +} + +void * +epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails) +{ + return do_dlsym(&api.glx_handle, GLX_LIB, name, exit_if_fails); } void * epoxy_glx_dlsym(const char *name) { - return do_dlsym(&api.glx_handle, GLX_LIB, name, true); + return epoxy_conservative_glx_dlsym(name, true); } void * diff --git a/src/dispatch_common.h b/src/dispatch_common.h index 2cc566a..9d38a78 100644 --- a/src/dispatch_common.h +++ b/src/dispatch_common.h @@ -162,6 +162,8 @@ bool epoxy_conservative_has_glx_extension(const char *name); int epoxy_conservative_egl_version(void); bool epoxy_conservative_has_egl_extension(const char *name); bool epoxy_conservative_has_wgl_extension(const char *name); +void *epoxy_conservative_egl_dlsym(const char *name, bool exit_if_fails); +void *epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails); bool epoxy_extension_in_string(const char *extension_list, const char *ext); |