https://kotlinlang.org logo
#ktor
Title
f

František Jeřábek

08/31/2022, 5:44 PM
Hi, I am trying to use ktor client with kotlin native and cio engine, but when i run the application i get
Copy code
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
The code looks like this
Copy code
import io.ktor.client.*
import io.ktor.client.engine.cio.*

fun main() {
    val client = HttpClient(CIO)
}
This is just a simple new instance. I think it should work but it does not 😐. Just in case it is important i am on
linuxX64
with dependencies
Copy code
implementation("io.ktor:ktor-client-core:2.1.0")
implementation("io.ktor:ktor-client-cio:2.1.0")
h

hfhbd

08/31/2022, 5:48 PM
Did you enable the new MM?
f

František Jeřábek

08/31/2022, 5:50 PM
No i just created new project and tried the
getting started with ktor client
. So i guess i should do that
That fixed it thanks a lot. I did not found anything about it in docs or i might just be blind.
14 Views