summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-03-29 16:39:05 +0200
committerAraq <rumpf_a@web.de>2016-03-29 16:39:05 +0200
commit13a83c7fdd92af9cda38c0c9cfafe2d555b34206 (patch)
treeb6bb9f24c585975047130f3d9f2f8ebacb3cf134 /lib
parentdb2b2156581ffaaa63e7ff9c0a07ced540006956 (diff)
downloadNim-13a83c7fdd92af9cda38c0c9cfafe2d555b34206.tar.gz
Windows: fixes a regression; codegen might not know about & at this point
Diffstat (limited to 'lib')
-rw-r--r--[-rwxr-xr-x]lib/pure/unittest.nim0
-rw-r--r--lib/system/dyncalls.nim5
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index aca9d51e2..aca9d51e2 100755..100644
--- a/lib/pure/unittest.nim
+++ b/lib/pure/unittest.nim
diff --git a/lib/system/dyncalls.nim b/lib/system/dyncalls.nim
index ba5e4bbeb..3b3d1f87d 100644
--- a/lib/system/dyncalls.nim
+++ b/lib/system/dyncalls.nim
@@ -109,9 +109,10 @@ elif defined(windows) or defined(dos):
   proc nimGetProcAddr(lib: LibHandle, name: cstring): ProcAddr =
     result = getProcAddress(cast[THINSTANCE](lib), name)
     if result != nil: return
+    var decorated: array[250, char]
     for i in countup(0, 50):
-      var decorated = "_" & $name & "@" & $(i * 4)
-      result = getProcAddress(cast[THINSTANCE](lib), cstring(decorated))
+      discard csprintf(decorated, "_%s@%ld", name, i*4)
+      result = getProcAddress(cast[THINSTANCE](lib), decorated)
       if result != nil: return
     procAddrError(name)
 
ight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
discard """
  output: '''false'''
"""

import macros

type
  nlOptions = enum
    nloNone
    nloDebug

var nlOpts {.compileTime.} = {nloDebug}

proc initOpts(): set[nlOptions] =
  result.incl nloDebug
  result.incl nloNone
  result.excl nloDebug

const cOpts = initOpts()

macro nlo() =
  nlOpts.incl(nloNone)
  nlOpts.excl(nloDebug)
  result = newEmptyNode()

nlo()
echo nloDebug in cOpts