Skip to content

Commit

Permalink
Windows import library fix
Browse files Browse the repository at this point in the history
  • Loading branch information
albertopasqualetto committed Aug 28, 2023
1 parent 5fdce4e commit 4f2a2f0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chromaprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _guess_lib_name():
if sys.platform == 'darwin':
return ('libchromaprint.1.dylib', 'libchromaprint.0.dylib')
elif sys.platform == 'win32':
return ('chromaprint.dll', 'libchromaprint.dll')
return ('', 'libchromaprint.dll')
elif sys.platform == 'cygwin':
return ('libchromaprint.dll.a', 'cygchromaprint-1.dll',
'cygchromaprint-0.dll')
Expand All @@ -44,7 +44,10 @@ def _load_library(name):
return None

try:
return ctypes.cdll.LoadLibrary(name)
if sys.platform == 'win32':
return ctypes.WinDLL(name, winmode=0)
else:
return ctypes.cdll.LoadLibrary(name)
except OSError:
return None

Expand Down

0 comments on commit 4f2a2f0

Please sign in to comment.