For memfiles, I believe there are issues on windows platform with trying to open a file again after a close.
(just scoping the size of the problem before raising a PR)
Can someone please test this on win32? (I know it fails on win64)
Also test with/without the compiler setting -d:release
import os, memfiles, times
proc runTst1(fname: string) =
var
file = memfiles.open(fname, fmRead)
i = 0
t0 = epochTime()
for field in lines(file):
inc(i)
memfiles.close(file)
echo "Read lines ", i, " lines! ", epochTime() - t0
proc main() =
if paramCount() < 1:
quit("ERROR: Please provide a file name for read testing")
runTst1(paramStr(1))
runTst1(paramStr(1))
main()
Without release:
Test.nim(18) Test
Test.nim(16) main
Test.nim(10) runTst1
memfiles.nim(280) close
oserr.nim(113) raiseOSError
Error: unhandled exception: unknown OS error [OSError]
With release:
Error: unhandled exception: unknown OS error [OSError]
I have submitted PR 6534
It still has a problem when -d:release is set (at least on win64) because the gcc flag -O3 (or -O1 or -O2) causes some sort of mapping failure.