diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/times.nim | 15 | ||||
-rw-r--r-- | lib/system.nim | 2 | ||||
-rw-r--r-- | lib/system/ansi_c.nim | 8 | ||||
-rw-r--r-- | lib/system/sysio.nim | 9 | ||||
-rw-r--r-- | lib/windows/winlean.nim | 4 |
5 files changed, 20 insertions, 18 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 553e3fe01..96668c4f8 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -83,16 +83,11 @@ when defined(posix) and not defined(JS): elif defined(windows): import winlean - when defined(vcc) or defined(bcc) or defined(icl): - # newest version of Visual C++ defines time_t to be of 64 bits - type TimeImpl {.importc: "time_t", header: "<time.h>".} = int64 - # visual c's c runtime exposes these under a different name - var - timezone {.importc: "_timezone", header: "<time.h>".}: int - else: - type TimeImpl {.importc: "time_t", header: "<time.h>".} = int - var - timezone {.importc, header: "<time.h>".}: int + # newest version of Visual C++ defines time_t to be of 64 bits + type TimeImpl {.importc: "time_t", header: "<time.h>".} = int64 + # visual c's c runtime exposes these under a different name + var + timezone {.importc: "_timezone", header: "<time.h>".}: int type Time* = distinct TimeImpl diff --git a/lib/system.nim b/lib/system.nim index 42d5794f5..207d616d2 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2872,7 +2872,7 @@ when not defined(JS): #and not defined(nimscript): importc: when defined(bcc): "setmode" else: "_setmode", header: "<io.h>".} var - O_BINARY {.importc: "O_BINARY", nodecl.}: cint + O_BINARY {.importc: "_O_BINARY", header:"<fcntl.h>".}: cint # we use binary mode on Windows: c_setmode(c_fileno(stdin), O_BINARY) diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index b2f6d314f..0bac979e7 100644 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -103,8 +103,12 @@ proc c_sprintf(buf, frmt: cstring): cint {. importc: "sprintf", header: "<stdio.h>", varargs, noSideEffect.} # we use it only in a way that cannot lead to security issues -proc c_fileno(f: File): cint {. - importc: "fileno", header: "<fcntl.h>".} +when defined(windows): + proc c_fileno(f: File): cint {. + importc: "_fileno", header: "<stdio.h>".} +else: + proc c_fileno(f: File): cint {. + importc: "fileno", header: "<fcntl.h>".} proc c_malloc(size: csize): pointer {. importc: "malloc", header: "<stdlib.h>".} diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index 7b6d93fe0..4f266e0ae 100644 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -15,9 +15,12 @@ {.push debugger:off .} # the user does not want to trace a part # of the standard library! - -proc c_fdopen(filehandle: cint, mode: cstring): File {. - importc: "fdopen", header: "<stdio.h>".} +when defined(windows): + proc c_fdopen(filehandle: cint, mode: cstring): File {. + importc: "_fdopen", header: "<stdio.h>".} +else: + proc c_fdopen(filehandle: cint, mode: cstring): File {. + importc: "fdopen", header: "<stdio.h>".} proc c_fputs(c: cstring, f: File): cint {. importc: "fputs", header: "<stdio.h>", tags: [WriteIOEffect].} proc c_fgets(c: cstring, n: cint, f: File): cstring {. diff --git a/lib/windows/winlean.nim b/lib/windows/winlean.nim index 7a221ceb1..c3229cc7b 100644 --- a/lib/windows/winlean.nim +++ b/lib/windows/winlean.nim @@ -14,8 +14,8 @@ import dynlib -when defined(vcc): - {.passC: "-DWIN32_LEAN_AND_MEAN".} + +{.passC: "-DWIN32_LEAN_AND_MEAN".} const useWinUnicode* = not defined(useWinAnsi) |