summary refs log tree commit diff stats
path: root/lib/system/io.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system/io.nim')
-rw-r--r--lib/system/io.nim11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/system/io.nim b/lib/system/io.nim
index 62722140f..a8f690054 100644
--- a/lib/system/io.nim
+++ b/lib/system/io.nim
@@ -35,12 +35,17 @@ type
 
 # text file handling:
 when not defined(nimscript) and not defined(js):
+  # duplicated between io and ansi_c
+  const stderrName = when defined(osx): "__stderrp" else: "stderr"
+  const stdoutName = when defined(osx): "__stdoutp" else: "stdout"
+  const stdinName = when defined(osx): "__stdinp" else: "stdin"
+
   var
-    stdin* {.importc: "stdin", header: "<stdio.h>".}: File
+    stdin* {.importc: stdinName, header: "<stdio.h>".}: File
       ## The standard input stream.
-    stdout* {.importc: "stdout", header: "<stdio.h>".}: File
+    stdout* {.importc: stdoutName, header: "<stdio.h>".}: File
       ## The standard output stream.
-    stderr* {.importc: "stderr", header: "<stdio.h>".}: File
+    stderr* {.importc: stderrName, header: "<stdio.h>".}: File
       ## The standard error stream.
 
 when defined(useStdoutAsStdmsg):