GLU callbacks in c++

I’d like to use GLU tessellation routines in order to texturize later a non-convex polygon.
The problem is than the third parameter of the gluTessCallback function is a pointer to a function ((void)(*f)()), but this works in C because it means “any function returning void”, but in C++ it means “any function returning void WITH NO PARAMETERS”, and the “vertex” callback function and “begin polygon” callback function must have one parameter (the point and the code of polygon to paint, respectively).
How can I avoid this problem? I’ve tried a casting, but it doesn’t work due to an invalid memory access when accessing the parameter.
Thank you very much.

Check the calling conventions on your platform. If it’s windows, there’s CCALL, STDCALL, CALLBACK, FASTCALL, … and your function pointer needs to have the right convention.

On Linux, you may need to, at least, declare the function extern “C”.

This has nothing to do with OpenGL, so if this doesn’t make sense to you, please consult your compiler and API documentation, and/or use the Google.

you have to declare it as being static as well.

static void CALLBACK myfunction(…);

V-man

Thank you, hours later I’ve found the solution:
reinterpreter cast<void *f ()>
With this casting, the compiler accept any extern C function with parameters.
Thank you all.