public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: SGI's opengl and cygnus
@ 1997-09-18 20:25 Colin Peters
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Peters @ 1997-09-18 20:25 UTC (permalink / raw)
  To: 'Garner Chung'; +Cc: 'GNU-Win32'

Garner Chung[SMTP:garnerbc@uclink2.berkeley.edu] wrote:
>I've been trying to compile some basic opengl programs using SGI's opengl
>implementation.  I started out by creating .a files from the opengl.dll and
>the glu.dll(not the opengl32.dll and the glu32.dll which are Microsoft's).
>
>impdef opengl.dll > opengl.def
>dlltool -k --def opengl.def --dllname opengl.dll --output-lib libopengl.a
>
>But then I ran into a problem:
>simpleci.o(.text+0xc33):simpleci.c: undefined reference to
>`wglCreateContext@4'
>simpleci.o(.text+0xc4b):simpleci.c: undefined reference to `wglMakeCurrent@8'
>simpleci.o(.text+0xc7e):simpleci.c: undefined reference to `wglMakeCurrent@8'
>simpleci.o(.text+0xc89):simpleci.c: undefined reference to
>`wglDeleteContext@4'
>
>But I soon realized that that was because of the "@NN"'s that are produced
>due to the fact that the wgl* functions are standard calls.

This is a correct evaluation of the problem.

>  So I removed
>the "STDCALL"'s from the wgl* function declarations which are in
><Windows32/Function.h>.

This is definitely the wrong solution. If you don't tell GCC that the
calls are STDCALL it will generate normal C calling convention calls
to those functions and they will fail...

[snip]
>(f:\Cygnus\home\opengl\misc\a.exe 1444) Error while dumping state (probably
>corrupted stack)

...because the stack will become totally out of whack (the technical term for
"corrupted").

Sorry if I sound harsh but: there's a *reason* all the prototypes are marked
STDCALL!

Fortunately for this particular case there is a reasonably easy solution.
The Cygnus source distribution includes .def files for opengl32 and glu32
among others. These .def files are for the MS versions of the OpenGL
libraries, but obviously, because the two sets of libraries are supposed
to be compatible, the function calls made available by the DLLs will be
the same (at least the vast majority of them). So:

 1. Get your hands on the opengl32.def and glu32.def files from the Cygnus
    source distribution (or any other source as long as the .def files
    include the precious @nn).

 2. Restore the header files to their original, STDCALL including state.

 3. Proceed from the dlltool step in your above process.

This should reduce to a handful, if not eliminate altogether, the
undefined references in your program.

Those references that remain undefined can be eliminated by simply
adding the name@nn that appears in the error message to the .def file
for the dll that exports the function of the appropriate name (which
you can use impdef to find).

This is somewhat painful (especially if you have to download and
unpack Cygnus' source distribution just for those two or three
files), but at least within the bounds of human endurance.

Colin.

-- Colin Peters - Saga Univ. Dept. of Information Science
-- colin@bird.fu.is.saga-u.ac.jp - finger for PGP public key
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SGI's opengl and cygnus
@ 1997-09-19 17:58 Rocky Burt
  0 siblings, 0 replies; 4+ messages in thread
From: Rocky Burt @ 1997-09-19 17:58 UTC (permalink / raw)
  To: gnu-win32, Garner Chung

I don't know if it was tried, garner, but I have the import libs for SGI's
opengl package on my webpage, along with GLUT.  It can be found at:
< http://dragon.acadiau.ca/~025668b/develop/opengl >

Rocky

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: SGI's opengl and cygnus
@ 1997-09-19  1:35 Garner Chung
  0 siblings, 0 replies; 4+ messages in thread
From: Garner Chung @ 1997-09-19  1:35 UTC (permalink / raw)
  To: gnu-win32

Thanks to Colin Peters, I think I have it basically "working."

thanks Colin.

garner
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* SGI's opengl and cygnus
@ 1997-09-18 18:36 Garner Chung
  0 siblings, 0 replies; 4+ messages in thread
From: Garner Chung @ 1997-09-18 18:36 UTC (permalink / raw)
  To: gnu-win32

I've been trying to compile some basic opengl programs using SGI's opengl
implementation.  I started out by creating .a files from the opengl.dll and
the glu.dll(not the opengl32.dll and the glu32.dll which are Microsoft's).

impdef opengl.dll > opengl.def
dlltool -k --def opengl.def --dllname opengl.dll --output-lib libopengl.a

But then I ran into a problem:
simpleci.o(.text+0xc33):simpleci.c: undefined reference to
`wglCreateContext@4'
simpleci.o(.text+0xc4b):simpleci.c: undefined reference to `wglMakeCurrent@8'
simpleci.o(.text+0xc7e):simpleci.c: undefined reference to `wglMakeCurrent@8'
simpleci.o(.text+0xc89):simpleci.c: undefined reference to
`wglDeleteContext@4'

But I soon realized that that was because of the "@NN"'s that are produced
due to the fact that the wgl* functions are standard calls.  So I removed
the "STDCALL"'s from the wgl* function declarations which are in
<Windows32/Function.h>.

Then I compiled again and got no errors.  But when I run the a.exe I
immediately get:

(f:\Cygnus\home\opengl\misc\a.exe 1444) In cygwin_except_handler
(f:\Cygnus\home\opengl\misc\a.exe 1444) Exception trapped!
(f:\Cygnus\home\opengl\misc\a.exe 1444) exception C0000005 at 24
(f:\Cygnus\home\opengl\misc\a.exe 1444) exception: ax 0 bx 240F238 cx 4 dx 0
(f:\Cygnus\home\opengl\misc\a.exe 1444) exception: si 240F224 di 401047 bp
FAD03
D4 sp 240F138
(f:\Cygnus\home\opengl\misc\a.exe 1444) exception is: STATUS_ACCESS_VIOLATION
(f:\Cygnus\home\opengl\misc\a.exe 1444) Stack trace:
(f:\Cygnus\home\opengl\misc\a.exe 1444) frame 0: sp = 0x240EF6C, pc =
0x1000CEC2

(f:\Cygnus\home\opengl\misc\a.exe 1444) frame 1: sp = 0x240EF88, pc =
0x77F94512

(f:\Cygnus\home\opengl\misc\a.exe 1444) frame 2: sp = 0x240EFAC, pc =
0x77F88EEB

(f:\Cygnus\home\opengl\misc\a.exe 1444) frame 3: sp = 0x240F038, pc =
0x77F76266

(f:\Cygnus\home\opengl\misc\a.exe 1444) In cygwin_except_handler
(f:\Cygnus\home\opengl\misc\a.exe 1444) Error while dumping state (probably
corrupted stack)

Any ideas?

garner
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-09-19 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-18 20:25 SGI's opengl and cygnus Colin Peters
  -- strict thread matches above, loose matches on Subject: below --
1997-09-19 17:58 Rocky Burt
1997-09-19  1:35 Garner Chung
1997-09-18 18:36 Garner Chung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).