gluTessCallback mystery


When I register my own functions with gluTessCallback I have to cast them:

typedef void (__stdcall * TessFuncPtr)( );
gluTessCallback( …, (TessFuncPtr) …);

Otherwise I get a compilation error.

When I register library functions (eg. glBegin(), glVertex3dv(), …) I don’t have to cast it to get the code to compile.

As far as I can tell, my functions have exactly the same signature as the corresponding library function.

Can anyone please explain this to me?

Btw, I’m compiling with gcc/3.3.1 under Cygwin.

The default calling convention in C and C++ is __cdecl, but the Win32 API, and that includes OpenGL, uses __stdcall.

Ah! I see. Thanks a bunch for clearing that up.