Skip to content

Commit

Permalink
Don't try to import DLL loaders from other platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewryanscott committed Oct 22, 2016
1 parent 487a00d commit 2dcc4cd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sunvox/dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
`sv_init` becomes `init`
"""

from ctypes import POINTER, Structure, cdll, c_char_p, c_int, c_short, c_ubyte, c_ushort, c_uint, c_void_p, windll
from ctypes import POINTER, Structure, c_char_p, c_int, c_short, c_ubyte, c_ushort, c_uint, c_void_p
from ctypes.util import find_library
from enum import IntEnum
import os
Expand All @@ -28,8 +28,6 @@
DLL_BASE = os.environ.get('SUNVOX_DLL_BASE', DEFAULT_DLL_BASE)
DLL_PATH = os.environ.get('SUNVOX_DLL_PATH')


loader = cdll
if DLL_PATH is not None:
_sunvox_lib_path = DLL_PATH
elif DLL_BASE is not None:
Expand All @@ -46,14 +44,18 @@
_lib_path = os.path.join(DEFAULT_DLL_BASE, 'windows', 'lib_x86')
os.environ['PATH'] = _lib_path + ';' + os.environ['PATH']
_sunvox_lib_path = rel_path
loader = windll
else:
if rel_path is not None:
_sunvox_lib_path = os.path.join(DLL_BASE, rel_path)
else:
raise NotImplementedError('SunVox DLL could not be found for your platform.')
else:
_sunvox_lib_path = find_library('sunvox')

if sys.platform == 'win32':
from ctypes import windll as loader
else:
from ctypes import cdll as loader
_s = loader.LoadLibrary(_sunvox_lib_path)


Expand Down

0 comments on commit 2dcc4cd

Please sign in to comment.