This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ problem when attempting to cast a function pointer in an OpenGL GLU callback


"Day, Michael A AMRDEC/UAH" wrote:

> test.cpp:72: error: invalid conversion from `void (*)()' to `void (*)()'

Win32 API functions generally use the stdcall calling convention, not
the standard C one.  Your tcbBegin is not defined this way and this
could be what the compiler is trying to tell you, although the error
certainly isn't very clear.

If you look at glu.h:

GLAPI void APIENTRY gluTessCallback (GLUtesselator* tess, GLenum which,
_GLUfuncptr CallBackFunc);

where _GLUfuncptr is defined as:

typedef void (APIENTRY *_GLUfuncptr)();

where APIENTRY expands to "__attribute__ ((__stdcall__))".  So you'll
need to declare your callback with that attribute or else it will not
work.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]