simonkrauter/NiGui

Compilation Error on Windows

KnorrFG opened this issue · 1 comments

Hey, I just updated nigui to version 0.2.5 and found a bug, tested on windows 10 with nim 1.4.2
This program compiles just fine with nim c main

main.nim

import nigui
import nigui / msgBox

app.init()

var 
    win = newWindow("test")
    exportButton = newButton("\u2611 Export")

win.add(exportButton)
exportButton.onClick = proc(ev: ClickEvent)=
    msgBox(win, "Test")

win.show()
app.run()

but when compiling with nim c --gc:arc main
it will produce the following error:
C:\Users\knorr\.nimble\pkgs\nigui-0.2.5\nigui\private\windows\platform_impl.nim(1564, 68) Error: expression cannot be cast to pointer

This is due to arc changing string representation (nim-lang/Nim#13154). Winim fixed in in khchen/winim@d300192, the relevant diff is at the bottom.

I wrote the code that's causing this and I'll try to take a look at it soon, possibly it can be fixed by just taking a pointer to the array instead of the string object itself (seems to be exported in lib/system/widestrs.nim).