From 682eb3c6dbf23c03e35439049a84a48139520350 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 14 Jan 2008 11:52:04 +0000 Subject: [PATCH] 2008-01-14 Emmanuele Bassi * clutter/cogl/gl/cogl.c (cogl_get_proc_address): Implement non-GLX version using GModule and looking up the symbol from the running process. It should work when linked to library providing the requested function. (#696, Tommi Komulainen) --- gl/cogl.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/gl/cogl.c b/gl/cogl.c index 222e74258..5f6395927 100644 --- a/gl/cogl.c +++ b/gl/cogl.c @@ -30,6 +30,7 @@ #include "cogl.h" #include +#include #ifdef HAVE_CLUTTER_GLX #include @@ -125,7 +126,24 @@ cogl_get_proc_address (const gchar* name) if (get_proc_func) return get_proc_func ((unsigned char*) name); -#endif + +#else /* !HAVE_CLUTTER_GLX */ + + /* this should find the right function if the program is linked against a + * library providing it */ + static GModule *module = NULL; + if (module == NULL) + module = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); + + if (module) + { + gpointer symbol; + + if (g_module_symbol (module, name, &symbol)) + return symbol; + } + +#endif /* HAVE_CLUTTER_GLX */ return NULL; }