summary refs log tree commit diff stats
path: root/lib/system/sysio.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-06 21:26:40 +0100
committerAraq <rumpf_a@web.de>2015-02-07 10:48:07 +0100
commite84834db79854c6ccc89263ec20d3749b8a87a05 (patch)
tree4232d1e7638c232eded8c6a1f3d82120f272d586 /lib/system/sysio.nim
parentd020ad097c7f1e8155c6b6e7bafbf7731caaafe8 (diff)
downloadNim-e84834db79854c6ccc89263ec20d3749b8a87a05.tar.gz
lots of C++ codegen improvements
Diffstat (limited to 'lib/system/sysio.nim')
-rw-r--r--lib/system/sysio.nim16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index 7908fbe4d..2e254c87b 100644
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -183,11 +183,17 @@ proc rawEchoNL() {.inline, compilerproc.} = write(stdout, "\n")
 when (defined(windows) and not defined(useWinAnsi)) or defined(nimdoc):
   include "system/widestrs"
 
-when defined(windows) and not defined(useWinAnsi):  
-  proc wfopen(filename, mode: WideCString): pointer {.
-    importc: "_wfopen", nodecl.}
-  proc wfreopen(filename, mode: WideCString, stream: File): File {.
-    importc: "_wfreopen", nodecl.}
+when defined(windows) and not defined(useWinAnsi):
+  when defined(cpp):
+    proc wfopen(filename, mode: WideCString): pointer {.
+      importcpp: "_wfopen((const wchar_t*)#, (const wchar_t*)#)", nodecl.}
+    proc wfreopen(filename, mode: WideCString, stream: File): File {.
+      importc: "_wfreopen((const wchar_t*)#, (const wchar_t*)#)", nodecl.}
+  else:
+    proc wfopen(filename, mode: WideCString): pointer {.
+      importc: "_wfopen", nodecl.}
+    proc wfreopen(filename, mode: WideCString, stream: File): File {.
+      importc: "_wfreopen", nodecl.}
 
   proc fopen(filename, mode: cstring): pointer =
     var f = newWideCString(filename)