It is sometimes necessary to use one of the *APIENTRY defines when defining functions in user code, for example with the callback for ARB_debug_output.
The Khronos headers make sure APIENTRY is defined after <GL/gl.h> or <GL/glext.h> by including <windows.h> if aplicable.
GLEW avoids including <windows.h> by manually defining APIENTRY (if not defined) and then cleaning it up at the end of the header.
This has the unfortunate effect that if <Gl/glew.h> is included without also including <windows.h>,
This means that user code that wishes to provide a GL callback needs to know about OS-specific OpenGL implementation details in order to either conditionally include <windows.h> or manually define their own APIENTRY variant.
This could easily be avoided by:
(Replace GLEWAPIENTRY with GLAPIENTRY or another name if you want to allow seperate ABIs for gl and glew functions)
This would ensure that
a) GLEWAPIENTRY is always defined after <GL/glew.h>
b) GLEWAPIENTRY always matches the calling convention used in the prototypes and typedefs provided by <GL/glew.h>
Agreed. This is a good proposal.
Fixed in GLEW git master branch.