This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 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: OpenGL header problems


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

> 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've done some simple tests.

#include <stdio.h>
#include <windows.h>

void __stdcall test_std(int x, int y);
void __fastcall test_fast(int x, int y);
void test(int x, int y);
void APIENTRY glPixelStorei (unsigned int, int);

int main(int argc, char *v[]) {
        glPixelStorei(1,2);
        test(1,2);
        test_std(1,2);
        test_fast(1,2);
        return 0;
}

 gcc test.c -lopengl32

/tmp/cc7SBe73.o(.text+0x45):test.c: undefined reference to `_test@8'
/tmp/cc7SBe73.o(.text+0x5c):test.c: undefined reference to `_test_std@8'
/tmp/cc7SBe73.o(.text+0x6e):test.c: undefined reference to `@test_fast@8'

Without the APIENTRY on glPixelStorei it is 
/tmp/cckNmsz4.o(.text+0x2e):test.c: undefined reference to `_glPixelStorei'
/tmp/cckNmsz4.o(.text+0x42):test.c: undefined reference to `_test'
/tmp/cckNmsz4.o(.text+0x56):test.c: undefined reference to `_test_std@8'
/tmp/cckNmsz4.o(.text+0x68):test.c: undefined reference to `@test_fast@8'


> 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.

A while ago I tried modifying the GL header shipped in xc/include. I had 
to change the #if defined(WIN32) to if defined(WIN32) || defined(__CYGWIN__)
an I got the correct stdcall symbols (_glPixelStorei@8) but got stuck with 
some other undefined symbols (which were from a newer OpenGL API and not in
opengl32.dll)

bye
	ago
-- 
 Alexander.Gottwald@s1999.tu-chemnitz.de 
 http://www.gotti.org           ICQ: 126018723
 Chemnitzer Linux-Tag 2004 - 6. und 7. März 2004
 http://www.tu-chemnitz.de/linux/tag


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