1. Duangle
  2. Untitled project
  3. pyopengl-cffi

Commits

Leonard Ritter  committed 2b3aa02

Fixed a win32 related DLL finding bug

  • Participants
  • Parent commits c79515d
  • Branches default

Comments (0)

Files changed (1)

File gl/internal.py

View file
 void *wglGetProcAddress(const char *); 
 """
 
+def find_win32_library(name):
+    WIN32_SEARCH_PATH = os.environ.get('PATH', '').split(os.pathsep)    
+    WIN32_SEARCH_PATH.insert(0, r'c:\windows\system32')
+    filename = name + '.dll'
+    for path in WIN32_SEARCH_PATH:
+        fullpath = os.path.join(path, filename)
+        if os.path.isfile(fullpath):
+            return fullpath 
+    return name
+
 def load_lib(cdefs):
     global _LIB
     
     #import time
     #t = time.time()
     if IS_WIN32:
-        libname = 'opengl32'
+        libname = find_win32_library('opengl32')
         cdefs += WIN32_WGL_CDEFS
     elif IS_DARWIN:
         libname = os.path.join(DARWIN_LIB_PATH, "libGL.dylib")