mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
fixes to allow the usage of clang on windows with the msvc abi and ms headers (#6442)
This commit is contained in:
committed by
Andreas Rumpf
parent
9b1a23c554
commit
d55e02ddf1
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>".}
|
||||
|
||||
@@ -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 {.
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
import dynlib
|
||||
|
||||
when defined(vcc):
|
||||
{.passC: "-DWIN32_LEAN_AND_MEAN".}
|
||||
|
||||
{.passC: "-DWIN32_LEAN_AND_MEAN".}
|
||||
|
||||
const
|
||||
useWinUnicode* = not defined(useWinAnsi)
|
||||
|
||||
Reference in New Issue
Block a user