File tree Expand file tree Collapse file tree 3 files changed +18
-13
lines changed Expand file tree Collapse file tree 3 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 1+ 2.0.0.3
2+ -------
3+ * Fixed dynamic loading of GLU library for recent GHC versions.
4+
152.0.0.2
26-------
37* Relaxed upper version bound for ` OpenGLRaw ` .
Original file line number Diff line number Diff line change 11name : GLURaw
2- version : 2.0.0.2
2+ version : 2.0.0.3
33synopsis : A raw binding for the OpenGL graphics system
44description :
55 GLURaw is a raw Haskell binding for the GLU 1.3 OpenGL utility library . It is
Original file line number Diff line number Diff line change @@ -69,10 +69,16 @@ hs_GLU_getProcAddress(const char *name)
6969#include <stdlib.h>
7070#include <dlfcn.h>
7171
72- #ifndef __APPLE__
73- #include <stdio.h>
74- #include <GL/glu.h>
72+ static const char * libNames [] = {
73+ #ifdef __APPLE__
74+ /* Try public framework path first. */
75+ "/Library/Frameworks/OpenGL.framework/OpenGL" ,
76+ /* If the public path failed, try the system framework path. */
77+ "/System/Library/Frameworks/OpenGL.framework/OpenGL"
78+ #else
79+ "libGLU.so" , "libGLU.so.1"
7580#endif
81+ };
7682
7783void *
7884hs_GLU_getProcAddress (const char * name )
@@ -81,18 +87,13 @@ hs_GLU_getProcAddress(const char *name)
8187 static void * handle = NULL ;
8288
8389 if (firstTime ) {
90+ int i , numNames = (int )(sizeof (libNames ) / sizeof (libNames [0 ]));
8491 firstTime = 0 ;
85- /* Get a handle for our executable. */
86- handle = dlopen (NULL , RTLD_LAZY );
92+ for (i = 0 ; (!handle ) && (i < numNames ); ++ i ) {
93+ handle = dlopen (libNames [i ], RTLD_LAZY | RTLD_GLOBAL );
94+ }
8795 }
8896
89- #ifndef __APPLE__
90- /* Hack to force linking of GLU on Linux */
91- FILE * bitbucket = fopen ("/dev/null" , "w" );
92- fprintf (bitbucket , "%p\n" , gluBeginCurve );
93- fclose (bitbucket );
94- #endif
95-
9697 return handle ? dlsym (handle , name ) : NULL ;
9798}
9899
You can’t perform that action at this time.
0 commit comments