PDA

View Full Version : gluTessCallback mystery



AndersS
01-17-2004, 01:24 AM
Hi!

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.

Bob
01-17-2004, 02:35 AM
The default calling convention in C and C++ is __cdecl, but the Win32 API, and that includes OpenGL, uses __stdcall.

AndersS
01-17-2004, 02:43 AM
Ah! I see. Thanks a bunch for clearing that up.