[Mesa-dev] Mesa (master): glapi: Add API that can create a _glapi_table from a dlfcn handle
Jeremy Huddleston
jeremyhu at freedesktop.org
Mon Jun 13 13:05:56 PDT 2011
Hi Brian,
Does this get rid of your warnings? (you'll need to regenerate the glapi_gentable.c)
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
index 0dfebf8..1681a80 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -42,7 +42,6 @@ header = """
#include "glapi.h"
#include "glapitable.h"
-#include "main/dispatch.h"
struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
@@ -50,7 +49,10 @@ _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
char symboln[512];
if(!disp)
- return NULL;
+ return NULL;
+
+ if(symbol_prefix == NULL)
+ symbol_prefix = "";
"""
footer = """
@@ -61,7 +63,7 @@ footer = """
body_template = """
if(!disp->%(name)s) {
snprintf(symboln, sizeof(symboln), "%%s%(entry_point)s", symbol_prefix);
- SET_%(name)s(disp, dlsym(handle, symboln));
+ disp->%(name)s = dlsym(handle, symboln);
}
"""
On Jun 13, 2011, at 7:22 AM, Brian Paul wrote:
> On 06/11/2011 11:18 PM, Jeremy Huddleston wrote:
>> Module: Mesa
>> Branch: master
>> Commit: 85937f4c0d4a78d3a11e3c1fa6148640f2a9ad7b
>> URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=85937f4c0d4a78d3a11e3c1fa6148640f2a9ad7b
>>
>> Author: Jeremy Huddleston<jeremyhu at apple.com>
>> Date: Thu Jun 9 16:59:49 2011 -0700
>>
>> glapi: Add API that can create a _glapi_table from a dlfcn handle
>>
>> Example usage:
>>
>> void *handle = dlopen(opengl_library_path, RTLD_LOCAL);
>> struct _glapi_table *disp = _glapi_create_table_from_handle(handle, "gl");
>>
>> Signed-off-by: Jeremy Huddleston<jeremyhu at apple.com>
>>
>> ---
>>
>> src/mapi/glapi/gen/Makefile | 9 +-
>> src/mapi/glapi/gen/gl_gentable.py | 131 +
>> src/mapi/glapi/glapi.h | 4 +
>> src/mapi/glapi/glapi_gentable.c | 7804 +++++++++++++++++++++++++++++++++++++
>> src/mapi/glapi/sources.mak | 1 +
>> 5 files changed, 7947 insertions(+), 2 deletions(-)
>>
>> Diff: http://cgit.freedesktop.org/mesa/mesa/diff/?id=85937f4c0d4a78d3a11e3c1fa6148640f2a9ad7b
>> _______________________________________________
>> mesa-commit mailing list
>> mesa-commit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-commit
>
>
> Jeremy,
>
> I'm getting a ton of warnings when glapi_gentable.c is compiled:
>
> glapi_gentable.c: In function ‘_glapi_create_table_from_handle’:
> glapi_gentable.c:52:10: warning: ISO C forbids passing argument 2 of ‘SET_NewLis
> t’ between function pointer and ‘void *’
> ../../../src/mesa/main/dispatch.h:2055:20: note: expected ‘void (*)(GLuint, GLe
> num)’ but argument is of type ‘void *’
> glapi_gentable.c:58:10: warning: ISO C forbids passing argument 2 of ‘SET_EndLis
> t’ between function pointer and ‘void *’
> ../../../src/mesa/main/dispatch.h:2066:20: note: expected ‘void (*)(void)’ but a
> rgument is of type ‘void *’
> glapi_gentable.c:64:10: warning: ISO C forbids passing argument 2 of ‘SET_CallLi
> st’ between function pointer and ‘void *’
> ../../../src/mesa/main/dispatch.h:2077:20: note: expected ‘void (*)(GLuint)’ but
> argument is of type ‘void *’
> glapi_gentable.c:70:10: warning: ISO C forbids passing argument 2 of ‘SET_CallLi
> sts’ between function pointer and ‘void *’
> ../../../src/mesa/main/dispatch.h:2088:20: note: expected ‘void (*)(GLsizei, GL
> enum, const GLvoid *)’ but argument is of type ‘void *’
> glapi_gentable.c:76:10: warning: ISO C forbids passing argument 2 of ‘SET_Delete
> Lists’ between function pointer and ‘void *’
> ../../../src/mesa/main/dispatch.h:2099:20: note: expected ‘void (*)(GLuint, GLs
> izei)’ but argument is of type ‘void *’
>
>
> I think the generator needs to insert some casts to pass the right function pointer type rather than void *.
>
> -Brian
>
More information about the mesa-dev
mailing list