oprypin / nim-random

Random number generation library for Nim
MIT License
68 stars 13 forks source link

urandom(16) not working on Windows? #30

Open pietroppeter opened 3 years ago

pietroppeter commented 3 years ago

using nim 1.4 on Windows and nim-random 0.5.7, the following file:

import random/urandom

echo urandom(16)

gives the following error:


C:\Users\ppeterlongo\nimcache\x_urandom_d\@m..@s.nimble@spkgs@srandom-0.5.7@srandom@surandom.nim.c: In function 'urandomInit__I9c059c8UXWLwo8XePhclOUw':
C:\Users\ppeterlongo\nimcache\x_urandom_d\@m..@s.nimble@spkgs@srandom-0.5.7@srandom@surandom.nim.c:423:84: error: 'PROV_RSA_FULL' undeclared (first use in this function); did you mean 'ERROR_DISK_FULL'?     
  success = Dl_12296201_((&cryptProv__QYmaJrNrOSePQ9c9bh9bYJIDA), NIM_NIL, NIM_NIL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
                                                                                    ^~~~~~~~~~~~~
                                                                                    ERROR_DISK_FULL
C:\Users\ppeterlongo\nimcache\x_urandom_d\@m..@s.nimble@spkgs@srandom-0.5.7@srandom@surandom.nim.c:423:84: note: each undeclared identifier is reported only once for each function it appears in
C:\Users\ppeterlongo\nimcache\x_urandom_d\@m..@s.nimble@spkgs@srandom-0.5.7@srandom@surandom.nim.c:423:99: error: 'CRYPT_VERIFYCONTEXT' undeclared (first use in this function); did you mean 'RPC_E_NO_CONTEXT'?
  success = Dl_12296201_((&cryptProv__QYmaJrNrOSePQ9c9bh9bYJIDA), NIM_NIL, NIM_NIL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
                                                                                                   ^~~~~~~~~~~~~~~~~~~
                                                                                                   RPC_E_NO_CONTEXT

Error: execution of an external compiler program 'gcc.exe -c  -w -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN   -IC:\Users\ppeterlongo\scoop\apps\nim\current\lib -IC:\Users\ppeterlongo\nimib -o C:\Users\ppeterlongo\nimcache\x_urandom_d\@m..@s.nimble@spkgs@srandom-0.5.7@srandom@surandom.nim.c.o C:\Users\ppeterlongo\nimcache\x_urandom_d\@m..@s.nimble@spkgs@srandom-0.5.7@srandom@surandom.nim.c' failed with exit code: 1```