summary refs log tree commit diff stats
path: root/lib/system/hti.nim
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2018-09-19 12:46:50 +0200
committerLemonBoy <thatlemon@gmail.com>2018-09-19 12:46:50 +0200
commit334032294ffd9549a772312cfe5e776c0b9aa934 (patch)
tree91988a9ff8995bab0fcdcd6f9382450b699c32a2 /lib/system/hti.nim
parenta892d519a60e08212ea05e99bb9f858e6673ee6b (diff)
downloadNim-334032294ffd9549a772312cfe5e776c0b9aa934.tar.gz
Fix linking issue in cpp codegen
Declare the root symbol only once and have the other modules depending
on it emit an `extern` declaration.

Fixes #9013
Diffstat (limited to 'lib/system/hti.nim')
-rw-r--r--lib/system/hti.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/system/hti.nim b/lib/system/hti.nim
index c7b52bbdf..bffe81bc8 100644
--- a/lib/system/hti.nim
+++ b/lib/system/hti.nim
@@ -103,6 +103,10 @@ type
   PNimType = ptr TNimType
 
 when defined(nimTypeNames):
-  var nimTypeRoot {.compilerProc.}: PNimType
+  # Declare this variable only once in system.nim
+  when declared(ThisIsSystem):
+    var nimTypeRoot {.compilerProc.}: PNimType
+  else:
+    var nimTypeRoot {.importc.}: PNimType
 
 # node.len may be the ``first`` element of a set