Joris PZ

    Joris PZ

    2 years ago
    Hi all, I'm participating in Advent of Code (https://adventofcode.com/2019) this year again, and just like last year, I'm trying to write my solutions in Kotlin common code, compile to bytecode, JS and native (MinGW), and do some rudimentary performance comparisons. Now, for today's puzzle I have added coroutines, and suddenly my MPP project fails to build. I have fiddled with absolutely everything - kotlin plugin version, gradle version, JDK version, library versions, in every permutation I could think off, but my build keeps failing with the completely unhelpful
    Execution failed for task ':linkDebugExecutableMingw'.
    > Process 'command 'C:\dev\java\openjdk-11.0.2\bin\java.exe'' finished with non-zero exit value 1
    Before I throw in the towel and just continue on JVM alone, if anyone would be willing to take a look to see what I could be doing wrong it would be much appreciated. The repo is https://github.com/jorispz/aoc-2019, the project is pretty much standard as generated by IDEA, with the addition of the coroutine depenendencies.
    Ah nevermind, the problem turned out to be that apparently in Kotlin Native you can't have a
    suspend fun main
    as an entry point... The error got lost in the noise somehow, so nothing to do with the build stuff
    j

    jk2018

    2 years ago
    How does your main function look then?
    Coroutines core works also on mingw, right?
    Been also working on a little windows tool and it's been quite the learning experience
    Joris PZ

    Joris PZ

    2 years ago
    Oh I just went from
    suspend fun main(args: Array<String>) {}
    to
    fun main(args: Array<String>) {
        runBlocking {
            // ...
        }
    }
    So yeah they work in mingw, though I understand only single-threaded and on the main thread for now due to https://github.com/Kotlin/kotlinx.coroutines/issues/462 which is why I believe that the single-threaded nature of
    runBlocking
    isn't an extra burden