summary refs log tree commit diff stats
path: root/compiler/ccgthreadvars.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/ccgthreadvars.nim')
-rw-r--r--compiler/ccgthreadvars.nim11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/ccgthreadvars.nim b/compiler/ccgthreadvars.nim
index c00b931ef..c24dd5c41 100644
--- a/compiler/ccgthreadvars.nim
+++ b/compiler/ccgthreadvars.nim
@@ -1,6 +1,6 @@
 #
 #
-#           The Nimrod Compiler
+#           The Nim Compiler
 #        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
@@ -57,6 +57,9 @@ proc generateThreadLocalStorage(m: BModule) =
 
 proc generateThreadVarsSize(m: BModule) =
   if nimtv != nil:
-    app(m.s[cfsProcs], 
-      "NI NimThreadVarsSize(){return (NI)sizeof(NimThreadVars);}" & tnl)
-
+    let externc = if gCmd != cmdCompileToCpp and
+                       sfCompileToCpp in m.module.flags: "extern \"C\""
+                  else: ""
+    appf(m.s[cfsProcs],
+      "$#NI NimThreadVarsSize(){return (NI)sizeof(NimThreadVars);}$n",
+      [externc.toRope])