summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/system/ansi_c.nim7
-rw-r--r--lib/system/io.nim7
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim
index 6649e9517..cb2303b61 100644
--- a/lib/system/ansi_c.nim
+++ b/lib/system/ansi_c.nim
@@ -117,9 +117,10 @@ type
   CFilePtr* = ptr CFile ## The type representing a file handle.
 
 # 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"
+const stdioUsesMacros = defined(osx) and not defined(emscripten)
+const stderrName = when stdioUsesMacros: "__stderrp" else: "stderr"
+const stdoutName = when stdioUsesMacros: "__stdoutp" else: "stdout"
+const stdinName = when stdioUsesMacros: "__stdinp" else: "stdin"
 
 var
   cstderr* {.importc: stderrName, header: "<stdio.h>".}: CFilePtr
diff --git a/lib/system/io.nim b/lib/system/io.nim
index 41716f9af..8e3acd0b9 100644
--- a/lib/system/io.nim
+++ b/lib/system/io.nim
@@ -36,9 +36,10 @@ 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"
+  const stdioUsesMacros = defined(osx) and not defined(emscripten)
+  const stderrName = when stdioUsesMacros: "__stderrp" else: "stderr"
+  const stdoutName = when stdioUsesMacros: "__stdoutp" else: "stdout"
+  const stdinName = when stdioUsesMacros: "__stdinp" else: "stdin"
 
   var
     stdin* {.importc: stdinName, header: "<stdio.h>".}: File