hello just wondering what the plans are or potential roadblocks to getting nim to be used by vcc on windows. I don't see any docs on this but there is obviously the mingw-64 download on the site.

The reason i'm asking is after getting to to "vkCreateCmdPool" in the vulkan api seemingly cannot go further because it seg-faults in nim.

I think it is a problem with the compiler(mingw) not working with the vcc build lib in the sdk. I can't prove that yet so no accusations here. But there are posts on stackoverflow about this.

Anybody got any ideas to make it work better? if not i will wait till nim switches to vcc to work on vulkan. But i do have some c++ code working with vulkan right now, it seems there are slight incompatabilities with mingw and vcc so i have to pick one.

2017-07-16 16:15:04
If you want to try to get vcc working (or define your own msvsc)
  • backup config/nim.cfg
  • edit config/nim.cfg (see below, the existing vcc definitions are for a really old compiler)
  • compile as nim c --cc:vcc file.nim

# Configuration for the Visual C/C++ compiler:
#vcc.exe = "vccexe.exe"
vcc.exe = "cl.exe"
#vcc.linkerexe = "vccexe.exe"
vcc.linkerexe = "link.exe"

# set the options for specific platforms:
@if i386:
  #vcc.options.always = "--platform:x86 /nologo"
  vcc.options.always = "/nologo"
  #vcc.options.linker = "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack vcc.options.linker = "/nologo   /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
@elif amd64:
  #vcc.options.always = "--platform:amd64 /nologo"
  vcc.options.always = "/nologo"
  #vcc.options.linker = "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
@elif arm:
  vcc.options.always = "--platform:arm /nologo"
  vcc.options.linker = "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
  vcc.options.always = "/nologo"
  vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB

vcc.options.debug = "/Zi /FS /Od"
vcc.options.speed = "/O2"
vcc.options.size = "/O1"

2017-07-17 00:02:46

@Kerp, I occasionally use vcc and mingw64 simultaneously. I don't think there's big different between two.

The different I can say is, when I played around about concurrency in Nim, threadpool module still has implicit bug that it can't run the second spawn when I tried it.

Also, addition to what @jlp765 mentioned, you can supply your additional nim.cfg in your project directory so any additional setting will overwrite default nim.cfg. If you want specific Nim file that use specific setting, you can use yourfile.nim.cfg so the config only apply to your specific file.

2017-07-17 02:23:49

Much easier alternative and it works

nim c -cc:vcc my.nim

2017-07-17 13:02:38
I'd recommend using the vccexe tool when using vcc. The release nim.cfg actually uses that anyways. I exclusively use VCC and I use the compiler included in Visual Studio 2017. My vccexe tool supports VCC 2010-2015 out of the box, and 2017 support can be added real easy by configuration. 2017-07-20 12:23:50