Nim version is 0.17.0, compiled it on win10x64 using x86_64-w64-mingw32-gcc, and confirmed the crash happening on a linux machine as well (where it too crashed after 16 iterations).
I'm unable to find any docs mentioning NimMainModule, and just putting NimMainModule() at the beginning of the DLL source gives me an undeclared identifier error. Could you please elaborate on how to manually run NimMainModule? Also, I take it that on a first glance, at least you didn't see any glaring flaws in the code above? Would you say it should run in theory?
