Skip to content

Commit

Permalink
Trial balloon: Use full path to GLUT framework on Apple platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
svenpanne committed May 12, 2016
1 parent c26b4ee commit e3f9bd2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2.7.0.9
--------
* Windows/Linux: The GLUT package compiles without any additional GLUT library now.
* The GLUT package compiles without any additional library/framework now.
* Windows: We search for a native freeglut DLL, a MinGW freeglut DLL and a classic GLUT DLL, in that order.

2.7.0.8
Expand Down
2 changes: 0 additions & 2 deletions GLUT.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ library
else
cpp-options: "-DCALLCONV=ccall"
cc-options: "-DUSE_DLSYM"
if os(darwin)
frameworks: GLUT

executable BOGLGP01-OnYourOwn1
if !flag(BuildExamples)
Expand Down
8 changes: 7 additions & 1 deletion cbits/HsGLUT.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ hs_GLUT_getProcAddress(const char *name)
#include <stdlib.h>
#include <dlfcn.h>

#ifdef __APPLE__
#define FILENAME "/System/Library/Frameworks/GLUT.framework/GLUT"
#else
#define FILENAME "libglut.so"
#endif

void*
hs_GLUT_getProcAddress(const char *name)
{
Expand All @@ -56,7 +62,7 @@ hs_GLUT_getProcAddress(const char *name)

if (firstTime) {
firstTime = 0;
handle = dlopen("libglut.so", RTLD_LAZY);
handle = dlopen(FILENAME, RTLD_LAZY | RTLD_GLOBAL);
}

return handle ? dlsym(handle, name) : NULL;
Expand Down

0 comments on commit e3f9bd2

Please sign in to comment.