OpenGL header problems

Igor Pechtchanski
Mon Mar 1 17:10:00 GMT 2004

On Mon, 1 Mar 2004, Harold L Hunt II wrote:

> As I mentioned in my email about enabling indirect OpenGL acceleration,
> there are some problems when trying to link to -lopengl32.
> I tracked this down to problems with the way that
> /usr/include/w32api/GL/gl.h decorates the function declarations for the
> gl* functions.  There are some collisions between the way that the
> standard windows headers define WINGDIAPI and APIENTRY and the way that
> gl.h expects them to be.
> However, the problem is a little trickier than just that: I added a call
> to glPixelStorei in Xserver/hw/xwin/InitOutput.c (without #including any
> opengl headers) and instead made my own prototype for glPixelStorei.  If
> I made it:
> void __stdcall glPixelStorei (unsigned int, int);
> then the linker would complain about how it had to fixup a reference to
> glPixelStorei as _glPixelStorei@8.  But that is exactly what the
> __stdcall was supposed to do, so I am getting a little confused about
> why the prototype was being ignored.
> I need an expert on __stdcall and w32api headers to give me a hand here.
>   Igor, I saw a post you made on this subject before, so I am counting
> on you :)
> Once this little trick is solved we will have to figure out how to get
> the proper headers in exports/include/GL/; that directory currently
> getes some Mesa headers in it.  I'm not sure if we can cleanly disable
> that and point to the w32api OpenGL headers instead.
> Harold


I'm by no means an expert, and I can't seem to reproduce it.  Could you
please post the exact gcc invocation that exhibits these symptoms?
Looking at ld's info page, there are a couple of options that could be
passed to the linker to modify this behavior.  It may also be a problem
with the import lib, for all I know...  Is the build seeing the right

Also, the GL/gl.h header doesn't actually use WINGDIAPI, and GLAPI is
defined to be "extern" on Cygwin.  Your declaration, however, seems
correct.  Just for kicks, could you try reverting to including GL/gl.h in
Xserver/hw/xwin/InitOutput.c and run the build command for that file with
a "-E" in CFLAGS?  That should produce a preprocessed version of
Xserver/hw/xwin/InitOutput.c, so you can see exactly how glPixelStorei is
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

More information about the Cygwin-xfree mailing list