How to choose a specific msvcr.dl in Nim?

Viewed 46

I would like to use an old msvcr71.dll when compiling Nim.

Is there a way to do so? If yes, how?

1 Answers

This is explained in the manual, right here. As StackOverflow doesn't like link responses, a copy-paste:

proc imported_proc(): ReturnType
  {.cdecl, dynlib: "msvcr71.dll", importc.}

This asumes there is a function in msvcf71.dll called imported_proc that you want to wrap in your Nim code without changing the name.

You can also tweak which libraries to load when compiling, as explained here:

$ nim c --dynlibOverride:msvcr71 --passL:msvcr71.dll program.nim

Didn't test any of the code, hope it helps. You can always try to find some code that does this kind of linking, for example https://github.com/khchen/wNim/blob/master/wNim/private/winimx.nim or maybe https://github.com/brentp/hts-nim/blob/master/src/hts/private/hts_concat.nim

Related