Playdate OS 2.0 brought some changes to how C games are built.
This unexpectedly made the example Nim project unable to compile.
This is the error the compiler outputs:
...
fini.c:(.text.__libc_fini_array+0x20): undefined reference to `_fini'
collect2: error: ld returned 1 exit status
make: *** [build/pdex.elf] Error 1
Workaround:
manually defining and exporting to C a _fini function somewhere in the codebase fixes the issue:
proc fini() {.cdecl, exportc: "_fini".} =
discard
The error seems to be caused by Nim generating C code that calls exit, which is not supported by the Playdate.
The exit calls generated by Nim seem related to exception handling.
Playdate OS 2.0 brought some changes to how C games are built. This unexpectedly made the example Nim project unable to compile.
This is the error the compiler outputs:
Workaround: manually defining and exporting to C a
_fini
function somewhere in the codebase fixes the issue:The error seems to be caused by Nim generating C code that calls
exit
, which is not supported by the Playdate. The exit calls generated by Nim seem related to exception handling.