summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/evalffi.nim3
-rw-r--r--compiler/vmgen.nim5
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim
index f2337f7ce..3b8ce0505 100644
--- a/compiler/evalffi.nim
+++ b/compiler/evalffi.nim
@@ -41,6 +41,8 @@ proc getDll(cache: var TDllCache; dll: string; info: TLineInfo): pointer =
 const
   nkPtrLit = nkIntLit # hopefully we can get rid of this hack soon
 
+var myerrno {.importc: "errno", header: "<errno.h>".}: cint ## error variable
+
 proc importcSymbol*(sym: PSym): PNode =
   let name = ropeToStr(sym.loc.r)
   
@@ -51,6 +53,7 @@ proc importcSymbol*(sym: PSym): PNode =
   of "stdin":  result.intVal = cast[TAddress](system.stdin)
   of "stdout": result.intVal = cast[TAddress](system.stdout)
   of "stderr": result.intVal = cast[TAddress](system.stderr)
+  of "vmErrnoWrapper": result.intVal = cast[TAddress](myerrno)
   else:
     let lib = sym.annex
     if lib != nil and lib.path.kind notin {nkStrLit..nkTripleStrLit}:
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 486d24e6c..ab120f008 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -945,10 +945,7 @@ proc genTypeLit(c: PCtx; t: PType; dest: var TDest) =
 proc importcSym(c: PCtx; info: TLineInfo; s: PSym) =
   when hasFFI:
     if allowFFI in c.features:
-      if s.kind == skVar and lfNoDecl in s.loc.flags:
-        c.globals.add(copyNode(emptyNode))
-      else:
-        c.globals.add(importcSymbol(s))
+      c.globals.add(importcSymbol(s))
       s.position = c.globals.len
     else:
       localError(info, errGenerated, "VM is not allowed to 'importc'")