Commits

Marcus von Appen committed 8635327

- issue #1: fix libc loading for cases where libc.so is a ld script

Comments (0)

Files changed (1)

 from .dll import _bind
 from ctypes import c_int, c_int8, c_uint8, c_int16, c_uint16, c_int32, \
     c_uint32, c_int64, c_uint64, cdll, c_size_t, c_void_p, c_char_p
+from ctypes.util import find_library
 
 __all__ = ["SDL_FALSE", "SDL_TRUE", "SDL_bool", "Sint8", "Uint8", "Sint16",
            "Uint16", "Sint32", "Uint32", "Sint64", "Uint64", "SDL_malloc",
 if sys.platform in ("win32", "cli"):
     _libc = cdll.msvcrt
 else:
-    _libc = cdll.LoadLibrary("libc.so")
+    _libc = cdll.LoadLibrary(find_library("c"))
+
 SDL_malloc = _bind("SDL_malloc", [c_size_t], c_void_p, _libc.free)
 SDL_calloc = _bind("SDL_calloc", [c_size_t, c_size_t], c_void_p, _libc.calloc)
 SDL_realloc = _bind("SDL_realloc", [c_void_p, c_size_t], c_void_p, _libc.realloc)