From a585caebcd70dd40c2b37f064818039362417d32 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 8 Oct 2014 09:10:57 +0200 Subject: [PATCH] bugfix: c++ support for 'NimThreadVarsSize' --- compiler/ccgthreadvars.nim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/ccgthreadvars.nim b/compiler/ccgthreadvars.nim index 60bc0fc4b5..c24dd5c412 100644 --- a/compiler/ccgthreadvars.nim +++ b/compiler/ccgthreadvars.nim @@ -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])