Skip to content

Commit

Permalink
Merge pull request #167 from Cyclical-/windows-dll
Browse files Browse the repository at this point in the history
Fix loading of DLLs on windows by adding a call to find_library()
  • Loading branch information
hmaarrfk authored Oct 9, 2020
2 parents 0a52124 + 3bd6701 commit e47bf20
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 9 deletions.
5 changes: 4 additions & 1 deletion picoscope/ps2000.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

super(PS2000, self).__init__(serialNumber, connect)

Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps2000a.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = self.loadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

self.resolution = self.ADC_RESOLUTIONS["8"]

Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps3000.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

super(PS3000, self).__init__(serialNumber, connect)

Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps3000a.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

self.resolution = self.ADC_RESOLUTIONS["8"]

Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps4000.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

super(PS4000, self).__init__(serialNumber, connect)
# check to see which model we have and use special functions if needed
Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps4000a.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

self.resolution = self.ADC_RESOLUTIONS["12"]

Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps5000.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

super(PS5000, self).__init__(serialNumber, connect)

Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps5000a.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

self.resolution = self.ADC_RESOLUTIONS["8"]

Expand Down
5 changes: 4 additions & 1 deletion picoscope/ps6000.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def __init__(self, serialNumber=None, connect=True):
self.lib = LoadLibraryDarwin("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(str(self.LIBNAME + ".dll"))
from ctypes.util import find_library
self.lib = windll.LoadLibrary(
find_library(str(self.LIBNAME + ".dll"))
)

super(PS6000, self).__init__(serialNumber, connect)

Expand Down

0 comments on commit e47bf20

Please sign in to comment.