Skip to content

Commit

Permalink
Properly locate libSystem.dylib on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
nneonneo committed May 4, 2020
1 parent 886456c commit b00daef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ifaddrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ class Ifaddrs(Structure):
('ifa_netmask', POINTER(Sockaddr)), ('ifa_dstaddr', POINTER(Sockaddr)),
('ifa_data', c_void_p)]

libc = CDLL('libSystem.dylib')
try:
libc = CDLL('libSystem.dylib')
except OSError:
from ctypes.util import find_library
libc = CDLL(find_library('libSystem.dylib'))
libc.getifaddrs.restype = c_int
libc.getifaddrs.argtypes = [POINTER(POINTER(Ifaddrs))]

Expand Down

0 comments on commit b00daef

Please sign in to comment.