Skip to content

Commit d43bf15

Browse files
committed
Fix math library functions
1 parent ef1dac6 commit d43bf15

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/pointers/_cstd.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
_c_library_name = find_library("c") or "libc.so.6"
2525

2626
dll = ctypes.CDLL(_c_library_name)
27-
27+
mdll = dll if platform in ("win32", "cygwin") else ctypes.CDLL(find_library("m") else "libm.so.6")
2828

2929
class tm(ctypes.Structure):
3030
_fields_ = [
@@ -136,20 +136,20 @@ class lconv(ctypes.Structure):
136136
dll.localeconv.argtypes = ()
137137
dll.localeconv.restype = ctypes.POINTER(lconv)
138138
# double frexp(double x, int* exponent)
139-
dll.frexp.argtypes = (
139+
mdll.frexp.argtypes = (
140140
ctypes.c_double,
141141
ctypes.POINTER(ctypes.c_int),
142142
)
143-
dll.frexp.restype = ctypes.c_double
143+
mdll.frexp.restype = ctypes.c_double
144144
# double ldexp(double x, int exponent)
145-
dll.ldexp.argtypes = (ctypes.c_double, ctypes.c_int)
146-
dll.ldexp.restype = ctypes.c_double
145+
mdll.ldexp.argtypes = (ctypes.c_double, ctypes.c_int)
146+
mdll.ldexp.restype = ctypes.c_double
147147
# double modf(double x, double* integer)
148-
dll.modf.argtypes = (
148+
mdll.modf.argtypes = (
149149
ctypes.c_double,
150150
ctypes.POINTER(ctypes.c_double),
151151
)
152-
dll.modf.restype = ctypes.c_double
152+
mdll.modf.restype = ctypes.c_double
153153
# int raise(int sig)
154154
c_raise.argtypes = (ctypes.c_int,)
155155
c_raise.restype = ctypes.c_int

0 commit comments

Comments
 (0)