summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-08-05 16:17:00 +0200
committerAraq <rumpf_a@web.de>2012-08-05 16:17:00 +0200
commitc0b444890407a52f1b812485ea9b89fc7c985e5f (patch)
tree7c3a21e488f76f583a1d73dd114fa649ad4fdaa0
parent19bc408ec6554da592a875ed8dc4d07b8838f975 (diff)
downloadNim-c0b444890407a52f1b812485ea9b89fc7c985e5f.tar.gz
bugfix: dynlib for variables
-rwxr-xr-xcompiler/pragmas.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index fd637f4c7..273bf98e8 100755
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -224,8 +224,9 @@ proc processDynLib(c: PContext, n: PNode, sym: PSym) =
       incl(sym.loc.flags, lfExportLib)
     # since we'll be loading the dynlib symbols dynamically, we must use
     # a calling convention that doesn't introduce custom name mangling
-    # cdecl is the default - the use can override this explicitly
-    if sym.typ.callConv == ccDefault:
+    # cdecl is the default - the user can override this explicitly
+    if sym.kind in RoutineKinds and sym.typ != nil and 
+        sym.typ.callConv == ccDefault:
       sym.typ.callConv = ccCDecl
 
 proc processNote(c: PContext, n: PNode) =