public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* What is the purpose of libglut32?
@ 2018-09-27 12:50 Matt D.
  2018-09-27 13:43 ` Jon Turney
  0 siblings, 1 reply; 2+ messages in thread
From: Matt D. @ 2018-09-27 12:50 UTC (permalink / raw)
  To: cygwin

Does anyone know what libglut32 is used for? It comes as part of 
"w32api-runtime" and "mingw64-i686-runtime" and is installed into:

usr/lib/w32api/libglut32.a

and

usr/i686-w64-mingw32/sys-root/mingw/lib/libglut32.a

I haven't been able to find a use for this as attempting to link with it 
produces the following errors:

undefined reference to `_imp____glutInitWithExit@12'
undefined reference to `_imp____glutCreateWindowWithExit@8'
undefined reference to `_imp____glutCreateMenuWithExit@8'

It is possible to link with it if -DGLUT_DISABLE_ATEXIT_HACK is used to 
skip these declarations but then it depends upon glut32.dll which isn't 
provided by any package. How can libglut32 be used for anything if it is 
missing its binary dependency? Is this library unused? Is the glut32.dll 
dependency an error?

Also note that this define really isn't meant to be used since it 
disables a necessary workaround as defined in freeglut_std.h.

See here:

 > Win32 has an annoying issue where there are multiple C run-time
 > libraries (CRTs). If the executable is linked with a different CRT
 > from the GLUT DLL, the GLUT DLL will not share the same CRT static
 > data seen by the executable. In particular, atexit callbacks
 > registered in the executable will not be called if GLUT calls its
 > (different) exit routine. GLUT is typically built with the
 > "/MD" option (the CRT with multithreading DLL support), but the Visual
 > C++ linker default is "/ML" (the single threaded CRT).
 >
 > One workaround to this issue is requiring users to always link with
 > the same CRT as GLUT is compiled with. That requires users supply a
 > non-standard option. GLUT 3.7 has its own built-in workaround where
 > the executable's "exit" function pointer is covertly passed to GLUT.
 > GLUT then calls the executable's exit function pointer to ensure that
 > any "atexit" calls registered by the application are called if GLUT
 > needs to exit.
 >
 > Note that the __glut*WithExit routines should NEVER be called
 > directly. To avoid the atexit workaround, #define
 > GLUT_DISABLE_ATEXIT_HACK.

This library is NOT the same as libgut, which seems to be the 
appropriate way to include glut, even when compiling for MinGW.


Matt D.

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

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

* Re: What is the purpose of libglut32?
  2018-09-27 12:50 What is the purpose of libglut32? Matt D.
@ 2018-09-27 13:43 ` Jon Turney
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Turney @ 2018-09-27 13:43 UTC (permalink / raw)
  To: The Cygwin Mailing List; +Cc: codespunk+cygwin

On 27/09/2018 13:48, Matt D. wrote:
> Does anyone know what libglut32 is used for? It comes as part of 
> "w32api-runtime" and "mingw64-i686-runtime" and is installed into:
> 
> usr/lib/w32api/libglut32.a
> 
> and
> 
> usr/i686-w64-mingw32/sys-root/mingw/lib/libglut32.a
> 
> I haven't been able to find a use for this as attempting to link with it 
> produces the following errors:
> 
> undefined reference to `_imp____glutInitWithExit@12'
> undefined reference to `_imp____glutCreateWindowWithExit@8'
> undefined reference to `_imp____glutCreateMenuWithExit@8'
> 
> It is possible to link with it if -DGLUT_DISABLE_ATEXIT_HACK is used to 
> skip these declarations but then it depends upon glut32.dll which isn't 
> provided by any package. How can libglut32 be used for anything if it is 
> missing its binary dependency? Is this library unused? Is the glut32.dll 
> dependency an error?

Fascinating.

So: the corresponding glut32.dll used to be provided by the 'opengl' 
package [1],[2]

[1] https://sourceware.org/ml/cygwin-announce/2012-06/msg00003.html
[2] https://sourceware.org/ml/cygwin-announce/2008-12/msg00005.html

I have no idea for what historical reason this is split up, with the 
import lib in w32api, but I guess we don't need that there anymore.

If you need glut for a non-cygwin application, I'd suggest using the 
cross freeglut packages mingw64-i686-freeglut and mingw64-x86_64-freeglut.

If you need glut for a cygwin application which uses GLX, use the 
libglut-devel.

If you need glut for a cygwin application which uses WGL, you'll have to 
build you own (although a package for this would be great)

This situation is briefly touched upon in [3], although I see that needs 
updating a bit.

[3] https://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-opengl-link-problems


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

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

end of thread, other threads:[~2018-09-27 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27 12:50 What is the purpose of libglut32? Matt D.
2018-09-27 13:43 ` Jon Turney

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