Using ctypes.WinDLL on Windows

This commit is contained in:
Sergey Lyubka committed 2012-06-07 22:04:40 +01:00
1 parent 7d5eb279a7
commit 22b430deb2
1 file changed
+4 -2
+4 -2
View File
@@ -118,8 +118,10 @@ class Mongoose(object):
"""A wrapper class for Mongoose shared library.""" """A wrapper class for Mongoose shared library."""
def __init__(self, callback, **kwargs): def __init__(self, callback, **kwargs):
dll_extension = os.name == 'nt' and 'dll' or 'so' if os.name == 'nt':
self.dll = ctypes.CDLL('_mongoose.%s' % dll_extension) self.dll = ctypes.WinDLL('_mongoose.dll')
else:
self.dll = ctypes.CDLL('_mongoose.so')
self.dll.mg_start.restype = ctypes.c_void_p self.dll.mg_start.restype = ctypes.c_void_p
self.dll.mg_modify_passwords_file.restype = ctypes.c_int self.dll.mg_modify_passwords_file.restype = ctypes.c_int