Skip to content

Commit d26c786

Browse files
committed
fix(windows): CC crash on dtoa:fixup: fix(builtins): round(float[, n]) not to-even (ref #52)
1 parent 87326ec commit d26c786

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/pylib/impure/math/dtoa-nim.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11

2+
#include <stdlib.h>
3+
24
void ACQUIRE_DTOA_LOCK(int);
35
void FREE_DTOA_LOCK(int);
46

57
int dtoa_get_threadno(void);
68

9+
// avoid MinGW complaining conflict with strtod of <stdlib.h>
10+
#define strtod nimpylib_dtoa_strtod
711
#include "./dtoa.c"
8-
12+
#undef strtod

src/pylib/impure/math/dtoa.nim

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,10 @@ char* dtoa(double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
6969
```]##
7070

7171
proc strtod*(
72-
s00: cstring, se: var cstring
73-
): cdouble{.importc: "strtod", cdecl.} ##[ ```c
72+
s00: cstring, se: (var cstring)|(ptr cstring) # for `strtod(s, nil)`
73+
): cdouble{.importc: "nimpylib_dtoa_strtod", cdecl.} ##[ ```c
7474
double strtod(const char *s00, char **se)
7575
```]##
7676

77-
proc strtod*(
78-
s00: cstring, se: ptr cstring
79-
): cdouble{.importc: "strtod", cdecl.} ## for `strtod(s, nil)`
80-
8177
proc freedtoa*(s: cstring){.importc, cdecl.}
8278

0 commit comments

Comments
 (0)