https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kotlin-native
  • a

    asad.awadia

    03/03/2019, 5:25 PM
    Can I kotlin-native compile a Maven project with all its dependencies? (mac OS X)
    c
    u
    • 3
    • 5
  • g

    GarouDan

    03/04/2019, 1:17 AM
    Hi guys, I’m receiving the following error in my build process.
    error: compilation failed: Could not find "/Users/travis/build/my_project/application/native/wasm/build/klib/kotlinx.interop.wasm.dom-jsinterop.klib" in [/Users/travis/build/my_project, /Users/travis/.konan/klib, /Users/travis/.konan/kotlin-native-macos-1.1.2/klib/common, /Users/travis/.konan/kotlin-native-macos-1.1.2/klib/platform/wasm32].
    But this error is only happening on the CI and not in my development machine. The strange thing is the same error is also happening in appveyor and circleci too. Does someone knows a workaround for this?
    s
    o
    • 3
    • 5
  • s

    Sam

    03/04/2019, 4:15 AM
    I started to do a little proof of concept today to see how well Kotlin Native objects would behave when being scripted from Javascript. I quickly hit a wall when I noticed that the
    .def
    file for
    JavaScriptCore
    is disabled. Does this not work at all? Or was it disabled a long time ago and nobody had checked it out since?
    o
    n
    s
    • 4
    • 12
  • i

    ivan.savytskyi

    03/04/2019, 4:36 PM
    hey folks trying to do this in MPP (iOS):
    actual constructor(longVal: Long) {
            delegate = NSDecimalNumber(longVal)
        }
    Getting error about ambiguity, looking into the bindings see 2 constructors that looks identical:
    @kotlinx.cinterop.ObjCConstructor public constructor(long: kotlin.Long) { /* compiled code */ }
    
    @kotlinx.cinterop.ObjCConstructor public constructor(longLong: kotlin.Long) { /* compiled code */ }
    Is it a bug, or there something I missing?
    s
    • 2
    • 2
  • e

    Ellen Shapiro

    03/04/2019, 8:08 PM
    is there a good explainer around on the difference between the
    kotlin-multiplatform
    plugin and the
    kotlin-native-platform
    plugin and when to use each?
    g
    s
    o
    • 4
    • 12
  • e

    Ellen Shapiro

    03/04/2019, 9:50 PM
    also, can anyone explain why i was able to build with coroutines by setting gradle to 4.10.1 and using
    enableFeaturePreview('GRADLE_METADATA')
    , but not using gradle 5.1, which theoretically has that built in? (I will accept “gremlins” as an answer at this point)
    d
    • 2
    • 12
  • i

    ivan.savytskyi

    03/05/2019, 5:17 AM
    what is the difference between
    kotlin.native.concurrent.Future.result
    and
    kotlin.native.concurrent.Future.consume(code: (T) -> R))
    . Seems like both are blocking, will block caller. I was assuming from API that
    Future.result
    - suppose to be blocking but
    Future.consume(code: (T) -> R))
    non blocking as it takes lambda.
    o
    • 2
    • 2
  • m

    mben

    03/05/2019, 4:58 PM
    Hello i've tried the project from here https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html, i understood that build generate a jar file for android and a framework file inside bin folder for ios but i only get the jar file when building with android studio how can i generate the framework file then pleaz?
    e
    • 2
    • 5
  • g

    gabin

    03/05/2019, 6:56 PM
    I used this command from tutorial “kotlinc-native -target android_arm32 -output hello_android.cgi hello.kt -e sample.main” it gave me *.so file. But on Android I wasn’t able to run it from console. It said “Illegal instruction”. Unlike for mac it generated console executable successfully
    o
    d
    u
    • 4
    • 30
  • g

    GarouDan

    03/06/2019, 1:40 AM
    In this post (https://superkotlin.com/kotlin-and-webassembly/) they say if we would like a full support to kotlin native wasm32 we should be using CLion. Is there a plugin on IntelliJ Ultimate so I could achieve the same result? I don’t know if I have all tools instaled and I would like to check.
    o
    • 2
    • 2
  • m

    Michael Bryant

    03/06/2019, 7:57 PM
    message has been deleted
    b
    • 2
    • 3
  • e

    Ellen Shapiro

    03/06/2019, 10:32 PM
    I’m working on some tests for something that executes asynchronously. Is there a
    runBlocking
    coroutines version that works in a
    commonTest
    for a multi-platform project?
    g
    o
    • 3
    • 8
  • g

    GarouDan

    03/09/2019, 12:37 AM
    Hello everyone, My build is failing here
    org.jetbrains.kotlin.konan.library.resolver.KonanLibraryResolverKt$TopologicalLibraryOrder$1$1.invoke(KonanLibraryResolver.kt:40)
    and I would like to inspect the code with breakpoints. Does someone knows how can I debug my konan build in IntelliJ? Where I’m using something like
    ./gradlew build
    for now and all of my build scripts are
    .gradle.kts
    ones
    g
    o
    • 3
    • 5
  • i

    ivan.savytskyi

    03/10/2019, 5:41 AM
    It might be a strange question, but I will shoot it anyway. When it’s “safe” to use
    TransferMode.UNSAFE
    for
    Worker
    transfer mode? Can we say if we are 100% sure that no one is going to mutate the thing we passed from the producer to the job, then it’s ok to use unsafe mode (and avoid freezing)? And second question what consequences to expect if smth goes wrong? (one thing I can think about is mem corruption issue, is there anything to watch out?)
    o
    k
    • 3
    • 13
  • s

    spierce7

    03/10/2019, 9:35 PM
    How often does the Kotlin/native compiler IR change, and how significantly? I'd like to use it at compile time to inspect classes that have a specific annotation, and then generate a separate wrapping class for them. Would I find any gotchas with the IR?
    o
    • 2
    • 1
  • k

    kpgalligan

    03/11/2019, 1:42 AM
    I’m working on some native platform coding. I have a local build of native branched at 1.1.0 release. Is there a way to config a multiplatform build to point at my local version?
    s
    • 2
    • 6
  • t

    tapchicoma

    03/11/2019, 2:19 PM
    To what maps in Obj-C
    abstract class
    ? Can't find it in
    OBJC_INTEROP.md
    s
    s
    • 3
    • 4
  • s

    spierce7

    03/12/2019, 9:48 PM
    If I submit multiple requests to a Worker, it appears that the worker will only process a single request at a time. Is that correct? This is a fairly large restriction given that this is the primary method to move data between threads. Especially when I consider that I'd like to receive requests with coroutines, and those coroutines could end up suspending, and I'd like the worker to be doing other things during that time. Do I have the wrong frame of mind, or is there a better way that I should be approaching this?
    k
    d
    o
    • 4
    • 12
  • b

    basher

    03/13/2019, 12:39 AM
    In the context of freezing, does a lambda have a sub graph? Does freezing a lambda freeze its captured state?
    k
    • 2
    • 1
  • s

    Sebastian Keller

    03/13/2019, 12:59 PM
    Hey! Is it possible to create an
    CPointer<BooleanVar>
    without the use of the nativeHeap? I would like to create one on the stack, but everything i've tried failed. Currently im using this
    val flag = nativeHeap.alloc<BooleanVar>(); flag.usePinned { it.get().ptr /* <- CPointer<BooleanVar> */}
    j
    • 2
    • 6
  • a

    AJ

    03/13/2019, 3:29 PM
    Hey guys, trying to create Rx bindings for iOS/Android. How is it possible to call custom Swift code from Kotlin(trying to call my own custom Swift classes with RxSwift inside)? Couldn't find any samples of calling custom Swift code from Kotlin, it is stated that you can do it using the @objc annotation and C-interop... Any help/info would be appreciated
    k
    • 2
    • 13
  • c

    Cyrille QUÉMIN

    03/13/2019, 4:28 PM
    hey, I am using kotlin
    1.3.30-eap-11
    and I have a multiplatform project that used to build just fine with
    1.3.21
    and now I have this exception during the link phase for iOS framework creation:
    e: Compilation failed: lateinit property parent has not been initialized
    . I looked in my entire source code I do not use
    lateinit
    and I do not have a variable named
    parent
    . I suspect this an error from the kotlin native source code itself. I’d like to know if there is a workaround I could try?
    Exception_in_kotlin_native_1_3_30-eap-11_while_building_iOS_framework.txt
    o
    j
    • 3
    • 7
  • a

    aerb

    03/13/2019, 5:24 PM
    Hi! Any recommendations on providing overrides to methods that are not exposed from Kotlin Native? I’m trying to subclass a UIView and override sizeToFit right now, but it appears like this is purposefully not allowed. Is there a recommended work around for this?
    s
    s
    +2
    • 5
    • 10
  • e

    Ellen Shapiro

    03/14/2019, 2:23 PM
    Once ABI and Module stability land in swift, is there any plan to use swift headers for iOS frameworks generated by native, or are they too dependent on Obj-C runtime features? Partly wondering because there isn’t really a great equivalent in ObjC to
    enum class
    and I want that
    switch
    functionality I could get in a swift
    enum
    s
    • 2
    • 3
  • g

    galex

    03/14/2019, 2:27 PM
    How do I initialise a variable inside an Object class that I need before doing requests? For doing the following:
    AnalyticsConfig.init().baseUrl = "<http://192.168.85.16:8000>"
    I get the following error:
    Uncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen com.analytics.core.helper.AnalyticsConfig@94d888
    e
    o
    s
    • 4
    • 31
  • g

    galex

    03/14/2019, 2:30 PM
    Here is the class itself:
    object AnalyticsConfig {
        lateinit var baseUrl: String
    }
    b
    • 2
    • 4
  • p

    ptmt

    03/14/2019, 5:38 PM
    What’s the best way to inspect a linker stage? I tried this:
    fromPreset(presets.iosX64, 'ios') {
                compilations.main {
                    kotlinOptions.freeCompilerArgs = [
                        '-Xlist-phases', 
                        '-Xverbose-phases=ObjectFiles', 
                        '-Xverbose-phases=SetUpLinkStage', 
                        '-Xverbose-phases=Linker']
                }
            }
    but not sure if I’m supposed to see something
    s
    • 2
    • 5
  • d

    Dico

    03/15/2019, 1:45 AM
    Given that K/N does not support traditional concurrency model, what are my options for multiplatform parallelization? I fail to see how this design decision can be a good one when multiplatform is added to the frame. It's held me back from using K/N seriously. If someone has an answer, enlighten me please.
    o
    r
    +2
    • 5
    • 21
  • b

    basher

    03/15/2019, 5:50 PM
    Is there a way to provide a Dispatcher.Main in native? Comments seem to indicate that on native, we should provide one, but I'm not seeing how to do that (i.e. where we would create and pass it to coroutines)
    d
    • 2
    • 7
  • b

    basher

    03/15/2019, 5:54 PM
    Is there a Worker-equivalent API available in native for main thread execution? Something that'd like me execute a block on the main thread, which I could run from a background worker?
    r
    o
    g
    • 4
    • 9
Powered by Linen
Title
b

basher

03/15/2019, 5:54 PM
Is there a Worker-equivalent API available in native for main thread execution? Something that'd like me execute a block on the main thread, which I could run from a background worker?
r

r4zzz4k

03/15/2019, 5:55 PM
Yep, it's even called
Worker
. You should freeze (make immutable) everything that crosses thread boundary though.
b

basher

03/15/2019, 5:56 PM
That's what I mean. I don't see a Worker.main
oh whoops i left out part of my question. fixed! should make more sense now
r

r4zzz4k

03/15/2019, 5:57 PM
You mean some ready-made abstraction around main-thread event loop? None to my knowledge.
b

basher

03/15/2019, 5:57 PM
yep that basically
okay thanks
o

olonho

03/15/2019, 7:21 PM
Main thread event queue is very platform/toolkit-specific, so we do not have this abstraction in standard library.
👍 1
g

gildor

03/16/2019, 2:31 AM
It is, but what about Main thread event queue for iOS?
b

basher

03/16/2019, 2:50 AM
Yep I can lean on that. Was hoping to have one that could be shared within native. kotlinx.coroutines has ThreadLocalEventLoop, but it's internal
View count: 2