Skip to content

Commit 4a9b652

Browse files
committed
Merge branch 'UltraStudioLTD-master'
2 parents 9539625 + 13e66cf commit 4a9b652

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
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") or "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

src/pointers/bindings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ._cstd import c_malloc as _malloc
1515
from ._cstd import c_raise as ct_raise
1616
from ._cstd import c_realloc as _realloc
17-
from ._cstd import dll
17+
from ._cstd import dll, mdll
1818
from ._utils import get_mapped, get_py
1919
from .base_pointers import BaseCPointer, BasePointer
2020
from .c_pointer import TypedCPointer, VoidPointer
@@ -505,15 +505,15 @@ def setlocale(category: int, locale: StringLike) -> str:
505505

506506

507507
def frexp(x: float, exponent: TypedPtr[int]) -> int:
508-
return binding_base(dll.frexp, x, exponent)
508+
return binding_base(mdll.frexp, x, exponent)
509509

510510

511511
def ldexp(x: float, exponent: int) -> int:
512-
return binding_base(dll.ldexp, x, exponent)
512+
return binding_base(mdll.ldexp, x, exponent)
513513

514514

515515
def modf(x: float, integer: TypedPtr[float]) -> int:
516-
return binding_base(dll.modf, x, integer)
516+
return binding_base(mdll.modf, x, integer)
517517

518518

519519
def fclose(stream: PointerLike) -> int:

0 commit comments

Comments
 (0)