fixes to allow the usage of clang on windows with the msvc abi and ms headers (#6442)

This commit is contained in:
Charlie Barto
2017-10-09 11:26:53 -04:00
committed by Andreas Rumpf
parent 9b1a23c554
commit d55e02ddf1
5 changed files with 20 additions and 18 deletions

View File

@@ -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>".}

View File

@@ -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 {.