Mesa (gallium-0.2): glut: Do not rely on GLAPIENTRY symbol.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Jan 23 14:55:28 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: d150e6a2e677a49813fdd5422b14ebdc59a904e9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d150e6a2e677a49813fdd5422b14ebdc59a904e9

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Jan 23 12:27:10 2009 +0000

glut: Do not rely on GLAPIENTRY symbol.

GLEW does some defining/undefining of GLAPIENTRY making it unreliable. GLEW
should also be fixed, but removing the dependency on this symbol.

This also restores the ability for GLUT to be used with -fvisibility=hidden.
The downside of this is that ld warns of:

  Warning: size of symbol `glutBitmapXXXXX' changed from 4 in glut_xxx.o to 16 in glut_xxxx.o

Due to the fonts being declared void * (*4 bytes), but defined as 16byte static
structure. I'll fix that in a later commit.

See also commits:
 - f321f16e83cae427d6496c11955fd1c898d0395c
 - d084982240bafba0169c4a6cacf02d45d6cfd8c1

---

 include/GL/glut.h |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/GL/glut.h b/include/GL/glut.h
index 45fed43..a3add59 100644
--- a/include/GL/glut.h
+++ b/include/GL/glut.h
@@ -200,10 +200,17 @@ WGLAPI int   GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
 #  pragma warning( pop )
 #endif
 
-#else /* _WIN32 not defined */
+#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
 
-/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */
-#  define GLUTAPIENTRY GLAPIENTRY
+#  define GLUTAPIENTRY
+#  define GLUTAPIENTRYV
+#  define GLUTCALLBACK
+#  define GLUTAPI __attribute__((visibility("default")))
+
+#else
+
+/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing */
+#  define GLUTAPIENTRY
 #  define GLUTAPIENTRYV
 #  define GLUTCALLBACK
 #  define GLUTAPI extern




More information about the mesa-commit mailing list