Re: unary operators are often best replaced by explicit names, eg: `%*` => toJson

2018-12-16 Thread timothee
=> PR [https://github.com/nim-lang/Nim/pull/10011](https://github.com/nim-lang/Nim/pull/10011)

Re: Returning cstring from a DLL

2018-12-16 Thread bobd
Digging into strings in DLLs a bit more, it turns out the second example does in fact work. The problem was caused by compiling the DLL with --noMain set. According to the docs the calling code will have enough time to make a copy before GC collects the string.

Re: Advent of Code 2018 megathread

2018-12-16 Thread nickmyers217
Yeah, day 16 was like a vacation compared to 15. I am back to work debugging 15 now, and I found an issue with my path finding. I think the best approach to debugging it is visualizations, so I am building out a little interactive mode that steps through the game step by step visually. Hopefully

Re: wNim - Nim's Windows GUI Framework

2018-12-16 Thread Ward
I have no plan to add it for now. However, [ZeeGrid](http://www.kycsepp.com/) may be a solution.

Re: Undefined reference to proc with {.importc.}

2018-12-16 Thread mashingan
Use [compile pragma](https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-pragma) or link pragma (below it) to point where the actual implementation code/binary available. Minimum example #include void greet() { printf("hello from sub\n");

Re: Undefined reference to proc with {.importc.}

2018-12-16 Thread lqdev
I tried that, same error thrown by ld.

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread mashingan
Don't have linux machine readily so cannot test it. Would try it later.

Undefined reference to proc with {.importc.}

2018-12-16 Thread lqdev
Hello, I'm trying to make a [Wren](http://wren.io/) wrapper for Nim, but I have trouble understanding Nim's FFI. So far I've got a folder structure like this: src/ - wren.nim - wren/ - incl/ - wren.h - wrapper.nim - vm/(...) Run The `src

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread trtt
Moving channel to the global scope(which I don't want anyway) created a new issue: GDB arguments(ignore to configure a gdbserver connection instead): Host(default = localhost): Port(default = 3000): Initializing gdb... Not found... ... Not found... Found m

Re: Undefined reference to proc with {.importc.}

2018-12-16 Thread trtt
Have you tried using header: h for wrenInitConfiguration's definition?

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread trtt
Also, the channel gets initialized 100% of the time because newGdbRemote() always worked. The channel never got closed and removing the only channel closing statement won't change anything because the error comes from an NPE in the stdlib.

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread trtt
After the "Initializing gdb..." the open will happen. newGdbRemote never failed - the exception happens after invocing run(). The exception happens at tryRecv()/send() which means it never reached the stop() method - there was no "Connected to gdbserver!" message either. Since neither newGdbRem

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread trtt
@mashingan I already tried that and the program crashed again - but I don't want a global variable anyway.

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread mashingan
The error message indicated it's error when you trying sending through the channel (and usually it's whether closed or not opened yet). Since in your exception is you already closed the channel, you should check whether gbdr.isSome or not.

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread mashingan
Try putting your channel (line 78) as a global? While inter-thread data can be exchanged using ptr, it's only working for simple data struct (cmiiw). And the phrase "channel is supposed be safe" is for channel that shared among threads, aka it's a global variable.

SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread trtt
I have [a prototype]([https://pastebin.com/fmdXREDK](https://pastebin.com/fmdXREDK)) gdb interface in nim and the channel always fails at either send() or tryRecv(): GDB arguments(ignore to configure a gdbserver connection instead): Host(default = localhost): Port(default =

Re: SIGSEGV at Channel.send/tryRecv

2018-12-16 Thread trtt
And the question: is this a bug or am I missing something(which is not in the docs)?

libtcod-nim

2018-12-16 Thread Vladar
Version [0.99](https://github.com/Vladar4/libtcod_nim/releases/tag/v0.99) * adaptation for the current Nim syntax * added 1.7.0 wrapper (SDL2 support) * bugfixes for both 1.5.1 and 1.7.0 wrappers

Re: Advent of Code 2018 megathread

2018-12-16 Thread lscrd
I encountered the same difficulties. The fact that the problem provides several test cases shows that the creators are aware of the difficulties. There are several traps to fall into. And, for part 2, there are also performance issues. For now, this problem has been the most challenging. Day 16