Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-12-01 Thread ringabout
Progress: replace data init function with consts for typeinfov2 has been merged. It should work for C backend.

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-30 Thread samdze
Thanks! The configuration I posted here is minimal, just to reproduce the issue. I do already use nimAllocPagesViaMalloc (and also build for arm when targeting the device) but didn't know the Playdate is using FreeRTOS! Nice!

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-29 Thread elcritch
Also looks like they're using FreeRTOS under the hood so you can also set `--os:freertos`. I found `--define:nimAllocPagesViaMalloc` to work well with FreeRTOS and embedded too. see

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-29 Thread ringabout
Please open an issue for this, I have a fix for it.

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-29 Thread elcritch
Not calling NimMain also causes all sorts of other issues too like global variables not being initialized. I ran into that one before too. :) You probably also want your cpu to match the target cpu not the hosts. So it'd be just `arm`. PS feel free to ask about the cortex m7's if you run into i

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-29 Thread ringabout
Another workaround is to use `--nomain:off`.

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-29 Thread samdze
Wow, that seems to be it. Thank you!

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-29 Thread guibar
I think the issue here is that the RTTI needs to initialized. You should probably call `NimMain()` in `eventHandler` before everything else.

Polymorphism doesn't work building a dylib for Playdate (Cortex M7) with ARC

2022-11-29 Thread samdze
I'm writing Nim bindings for the C SDK release by Panic for the Playdate portable console. However, I stumbled upon an issue writing a more ergonomic API over the existing one. I'm testing this on the Playdate simulator. Polymorphism doesn't work as expected, here's my code: # ---