Hi everyone,
I am starting to learn Nim and I'm encountering a weird issue where the compiled program will hand (no response, even pressing Ctrl+C won't stop the program) when adding an item to a Seq.
Here is the code so far : https://github.com/ronangaillard/psx-emu
The program hangs at line 10 of file src/core/interconnect.nim. ( I know this because I put echo commands before and after this.memoryZones.add(mz) and the echo after would not print.
Here is my current configuration :
nim -v
Nim Compiler Version 0.20.2 [MacOSX: amd64]
Compiled at 2019-07-18
Copyright (c) 2006-2019 by Andreas Rumpf
active boot switches: -d:release -d:useLinenoise
sw_vers
ProductName: Mac OS X
ProductVersion: 10.15
BuildVersion: 19A546d
Unfortunately the repo lacks "./assets/SCPH1001.BIN" so I'm unable to reproduce the problem.
However, this line is wrong:
f.readData(addr(this.data), size)
You need to do this f.readData(addr(this.data[0]), size) because seqs have a header. (Much like in other langs really, ...)
You are right, this works perfectly thanks !
One interesting thing is that when the program was built in debug mode the program would hang, but in release mode if just crashed. Not sure that hanging is an expected behaviour ?