function prototype

From: <- Chameleon -> (cham_gss_at_hotmail.NOSPAM.com)
Date: 02/27/04


Date: Sat, 28 Feb 2004 00:52:03 +0200

When I use 1st line in prototypes, compiler fails because SDL_GL_GetProcAddress return (void*)
When I use 2nd line in prototypes, compiler fails in last line because (void*) is not a function prototype.
So, what cast I must use?
Can you rewrite these 3 lines correctly?
With 1st line in prototypes, I used:
glCompressedTexImage2DARB =
    (void (*glCompressedTexImage2DARB)
    (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*))
    SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
but it does not work
-------------------------------------------------------------------------
//prototypes
void (*glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*);
//void *glCompressedTexImage2DARB;

//load function
glCompressedTexImage2DARB = SDL_GL_GetProcAddress("glCompressedTexImage2DARB");

//use function
glCompressedTexImage2DARB(GL_TEXTURE_2D, z, dxt_f, width, height, 0, size, (byte*) tex + offset);



Relevant Pages

  • Re: glTexImage3D in Windows 2000
    ... My compiler cannot link to glTexImage3D, ... void (GLenum, GLint, GLint, GLsizei, GLsizei, ... GLsizei, GLint, GLenum, GLenum, void*)) tmpFct; ...
    (comp.graphics.api.opengl)
  • glTexImage3D in Windows 2000
    ... void (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, ... GLint, GLenum, GLenum, void*); ...
    (comp.graphics.api.opengl)
  • Newb: Need assistance with glVertex*()
    ... void init(void); ... void reshape(GLsizei, GLsizei); ... void drawOneLine(GLfloat, GLfloat, GLfloat, GLfloat); ... glutInit(&argc, argv); ...
    (comp.graphics.api.opengl)
  • [2.6 patch] calibrate_delay() must be __cpuinit
    ... - remove pointless additional prototypes in C files ... -extern void calibrate_delay; ... extern void start_ap; ... printk("Calibrating delay loop (skipped)... ...
    (Linux-Kernel)
  • Re: Function prototypes
    ... I'm guessing that this rule exists because the compiler at your ... with no support for prototypes. ... void f ... int main ...
    (comp.lang.c)