Issue #31 resolved

error: assigning to 'void (*)(GLenum, GLint *)' from incompatible type 'void *'

Robert Menzel
created an issue

Hello,

I get compile errors with gcc on linux as well as clang on MacOS X in the function 'ogl_LoadFunctions' when creating a loader with the 'pointer_c' style. The problematic code is:

_ptrc_glGetIntegerv = IntGetProcAddress("glGetIntegerv");
if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED;
_ptrc_glGetStringi = IntGetProcAddress("glGetStringi");
if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED;

It can be fixed by a simple cast:

_ptrc_glGetIntegerv = (void (*)(GLenum,GLint*)) IntGetProcAddress("glGetIntegerv");
if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED;
_ptrc_glGetStringi = (const GLubyte* (*)(GLenum,GLuint)) IntGetProcAddress("glGetStringi");
if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED;

Which can be created by the lua files when the function 'WriteInMainFunctionLoader' in 'StylePointerC.lua' gets an additional parameter for the cast string and calling it in the function 'WriteMainLoaderFunc' gets these two strings shown above.

With this fix and the fix discussed in issue 29 the loader works also on MacOS X (quick test on 10.8, OpenGL 3.2 context).

Comments (6)

  1. Daniel Guzman

    I'm getting the same error, the solution is what Robert Menzel did but with a minor fix that will compile windows7 microsoft too.

    _ptrc_glGetIntegerv = (void (*)(GLenum,GLint*)) IntGetProcAddress("glGetIntegerv");
    if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED;
    _ptrc_glGetStringi = (const GLubyte* (*)(GLenum,GLuint)) IntGetProcAddress("glGetStringi");
    if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED;
    

    SHOULD BE ... (CODEGEN_FUNCPTR)

    _ptrc_glGetIntegerv = (void (CODEGEN_FUNCPTR *)(GLenum, GLint*) )IntGetProcAddress("glGetIntegerv");
        if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED;
        _ptrc_glGetStringi = (const GLubyte* (CODEGEN_FUNCPTR *)(GLenum, GLuint) )IntGetProcAddress("glGetStringi");
        if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED;
    

    Thank you for this great loader :)

  2. Log in to comment