nimscript failed to compile/run -- Error: cannot 'importc' variable at compile time #4561

Closed
jangko opened this Issue Aug 3, 2016 · 0 comments

Projects

None yet

1 participant

@jangko
Contributor
jangko commented Aug 3, 2016 edited

I have this short nimscript act as build script:

mode = ScriptMode.Verbose

import strutils

var switches = ""

proc addSwitch(sw: string) =
  switches.add " --"
  switches.add sw

addSwitch("path:platform")
addSwitch("path:cef")
addSwitch("path:nimcef")
addSwitch("path:util")
addSwitch("path:wrapper")
addSwitch("threads:on")
addSwitch("tlsEmulation:off")
addSwitch("define:winUnicode")

when defined(release):
  addSwitch("define:release")

exec "nim c $1 test_client" % [switches]
exec "nim c $1 test_api" % [switches]
exec "nim c $1 test_nim_api" % [switches]
exec "nim c $1 test_parser" % [switches]
exec "nim c $1 test_simple_client" % [switches]

everything was fine until recently, i got this

F:\projects\nimCEF>nim e build.nims
Hint: used config file 'F:\projects\Nim\config\nim.cfg' [Conf]
f:\projects\nim\lib\system.nim(3677, 11) Error: cannot 'importc' variable at compile time

and here what I get in system.nim at line 3677

when defined(windows) and appType == "console":
  proc setConsoleOutputCP(codepage: cint): cint {.stdcall, dynlib: "kernel32",
    importc: "SetConsoleOutputCP".}
  discard setConsoleOutputCP(65001) # 65001 - utf-8 codepage

this practically will prevent any nimscript in Windows platform to compile, am I right?

@Araq Araq added a commit that closed this issue Aug 3, 2016
@Araq Araq fixes #4561 fb37224
@Araq Araq closed this in fb37224 Aug 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment