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
  • k

    Kris Wong

    01/13/2020, 8:45 PM
    if a lambda captures a class member, and the lambda is frozen, why does it need to freeze the member's parent object?
    b
    d
    +2
    • 5
    • 74
  • b

    Big Chungus

    01/14/2020, 11:08 AM
    Is there a way to convert Worker to coroutineDispatcher/Context? I need to ensure that the callback from coroutine job is executed on the same thread that launched the coroutine
    k
    • 2
    • 7
  • t

    Thomas

    01/14/2020, 11:56 AM
    Does anyone know why the mt version of DroidconKotlin has the
    CoroutineScope
    moved to a separate class? See the following: https://github.com/touchlab/DroidconKotlin/blob/kpg/mt_coroutines/sessionize/lib/src/commonMain/kotlin/co/touchlab/sessionize/BaseModel.kt If you check the master branch than you can see that
    BaseModel
    just implements
    CoroutineScope
    . In the
    kpg/mt_coroutines
    branch that implementation was moved to a separate class, called
    MainScope
    . Is there a reason behind this change to support mt coroutines? Is it possible that
    MainScope
    can become frozen for some reason?
    k
    • 2
    • 44
  • s

    Sam Schilling

    01/14/2020, 5:08 PM
    Anyone experience this and find a solution? It seems easy to fix, but I’ve already checked and my Kotlin Gradle plugin is set to 1.3.61. Tried invalidating caches/restarting but it didn’t fix anything.
    10:06 AM	Incompatible Kotlin/Native libraries
    				There are 227 libraries from the Kotlin/Native 1.3.50 distribution attached to the project: stdlib, ARKit, AVFoundation, AVFoundation, AVKit, ...
    				These libraries were compiled with an older Kotlin/Native compiler and can't be read in IDE. Please edit Gradle buildfile(s) to use Kotlin Gradle plugin version 1.3.61. Then re-import the project in IDE.
    d
    k
    • 3
    • 12
  • r

    ribesg

    01/15/2020, 9:16 AM
    Any way to implement
    deinit
    in Kotlin on iOS? I guess not but you never know
    l
    a
    s
    • 4
    • 17
  • h

    hooliooo

    01/15/2020, 10:14 AM
    I posted this in #multiplatform but deleted the post since I think this is the more appropriate channel because it’s more of an iOS Kotlin Native issue: Hi all, I’m currently running into an archiving issue with an iOS app using a framework created from Kotlin multiplatform with the FatFrameworkTask. Previous versions worked and the iOS app has live builds with the framework, however, in the latest attempt to create a new Testflight build where I upgraded the following dependencies in the KMP project:
    const val kotlin_version = "1.3.61" previously "1.3.40"
    const val coroutines_version = "1.3.3" previously "1.3.40"
    const val ktor_version = "1.2.6" previously  "1.2.2"
    const val serialization_version = "0.14.0" previously "0.11.1"
    const val mockk_version = "1.9.3"
    The framework is created. The app works in debug mode. The issue is strictly archiving. I’m running into this issue:
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    Intrinsic has incorrect argument type!
    i32 (i8*, i1, i1, i1)* @llvm.objectsize.i32.p0i8
    LLVM ERROR: Broken module found, compilation aborted!
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Command Ld failed with a nonzero exit code
    Has anyone encountered this issue? I’m quite sure it’s related to the changes in the KMP project because reverting the framework (via cocoapods) to the previous version results in a successful archiving. The minimum target for the app is iOS 10.0 so a 32 bit architecture is supported
    s
    i
    • 3
    • 10
  • r

    Robert

    01/15/2020, 3:48 PM
    I'd like to use the bitcoin library (which is C++) in Kotlin. Is there a way to do this (via Interop?)? https://github.com/bitcoin/bitcoin Ideally I would like to be able to call it from common code in my Kotlin Multiplatform project eventually. Other "option" would be porting the complete library, which is not feasable both in amount of work as in efforts to maintain/sync with original code.
    e
    k
    r
    • 4
    • 14
  • w

    Whitley

    01/15/2020, 4:59 PM
    Hi all, does anyone know the best way to create and distribute a KN binary - without source - that’s consumable for iOS developers? Preferably via Cocoapods?
    k
    b
    • 3
    • 11
  • s

    Sam Schilling

    01/15/2020, 10:36 PM
    From https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-atomic-reference/value.html
    The referenced value. Gets the value or sets the new value. If new value is not null, it must be frozen or permanent object.
    What is a permanent object? I have not seen that language used elsewhere before
    k
    o
    • 3
    • 5
  • g

    galex

    01/16/2020, 12:26 PM
    Hello, we’d like to use Filament (google’s renderer) on both platforms (Android and iOS). Is it correct we should use cinterop to create a filament.klib and use that? Or is there already something else out there to ease the process?
    k
    s
    r
    • 4
    • 12
  • s

    Sam Schilling

    01/16/2020, 5:17 PM
    Is there a way to instantiate an object of a certain class using reflection in K/N? Sadly looks like
    KClass.constructors
    is only available in JVM/JS
    s
    o
    • 3
    • 5
  • k

    Kavan

    01/17/2020, 9:25 AM
    What is multiplatform maven repository URL for kotlin-dev channel ?
    m
    d
    • 3
    • 9
  • b

    Big Chungus

    01/17/2020, 10:19 AM
    Not directly related to K/N, but could someone tell me how to set
    background-colour
    to GTK3 button? Preferably with inline css (no .css files)
    k
    n
    • 3
    • 6
  • b

    Big Chungus

    01/17/2020, 10:20 AM
    Also, how can i create a common
    KotlinNativeSourceSet
    with cinterops?
    a
    k
    • 3
    • 5
  • r

    ribesg

    01/17/2020, 11:50 AM
    I have some problems with cinterops. I’m trying to add this to my iOS project: https://material.io/develop/ios/components/textfields/ My def file is like this:
    depends = Foundation
    package = framework.MaterialTextFields
    language = Objective-C
    headers = MaterialTextFields.h MaterialTextFields+Theming.h
    
    compilerOpts = -framework MaterialComponents
    linkerOpts = -framework MaterialComponents
    My problem is that when I run cinterops I get this error:
    Exception in thread "main" java.lang.Error: /Users/ribesg/XcodeProjects/events/Pods/MaterialComponents/components/TextFields/src/Theming/MDCTextInputControllerFilled+MaterialTheming.h:15:9: fatal error: 'MaterialComponents/MaterialContainerScheme.h' file not found
    I found that
    MDCTextInputControllerFilled+MaterialTheming.h
    contains this line
    #import <MaterialComponents/MaterialContainerScheme.h>
    and cinterops does not seem to understand it properly. I do have this
    MaterialContainerScheme.h
    file in the context but it’s not in a folder/module/whatever called
    MaterialComponents
    I guess. How do I make this work?
    a
    a
    • 3
    • 13
  • b

    basher

    01/18/2020, 10:06 PM
    anyone have success fixing cinterop IntelliJ autocomplete/index issues? I have cinterops setup and building fine, but none of the symbols show up in the index.
    kotlinx.cinterop
    imports are also red
    n
    k
    d
    • 4
    • 14
  • k

    Kavan

    01/19/2020, 6:22 AM
    I wanna use 1.4.0-dev compiler in intellij, I tried changing multiplatform to 1.4.0-dev-NNNN. it changed libraries to 1.4.0-dev but compiler is 1.3.70-dev. why ?
    m
    e
    i
    • 4
    • 7
  • b

    basher

    01/19/2020, 6:29 AM
    How do you see the actual cinterop errors when you run into
    fatal error: could not build module X
    because it's finding an error and failing
    org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:146
    ?
    • 1
    • 1
  • d

    Dominaezzz

    01/19/2020, 5:34 PM
    Anyone have a mac I can borrow? I just want to see if a K/N repo can build and run without issue. (Can't see GUI in GitHub actions 😞)
    b
    a
    +2
    • 5
    • 17
  • n

    napperley

    01/20/2020, 3:49 AM
    Are there plans for a Linux ARM version of the Kotlin Native compiler (one that will run on a Raspberry Pi for example)? Been having one headache after another with trying to cross compile on a Linux x64 PC for a Linux ARM v7 device (a Raspberry Pi via the linuxarm32hfp target). Would be significantly easier to compile directly on a Linux ARM v7 device if the Kotlin Native compiler was available.
    o
    • 2
    • 3
  • p

    Patrick

    01/20/2020, 9:58 AM
    How should i handle interfaces when I export a KN project as a c library? If my function expects a property of a certain interface it does not allow me to cast the property I need to that interface. Is there another way that I have overlooked?
    a
    • 2
    • 2
  • p

    Patrick

    01/20/2020, 11:07 AM
    Also another problem I am noticing now: The HashMap type has no definition in the header file. Do I have to call those functions blindly or why are they not exported?
    a
    • 2
    • 10
  • k

    Kavan

    01/20/2020, 1:16 PM
    I'm waiting for java independent Kotlin compiler
    👍 1
    d
    g
    +2
    • 5
    • 41
  • k

    Kavan

    01/20/2020, 1:41 PM
    In keynote @abreslav said 1.4.0 more about performance. That's cool. I don't know why but I like that guy. Right now release build performance is nearly same as C. And in 1.4.0 it gonna more fast. That's awesome.
    d
    • 2
    • 5
  • n

    napperley

    01/21/2020, 1:48 AM
    Is it possible to dynamically select a def file during the build process based on the target?
    a
    • 2
    • 1
  • n

    napperley

    01/21/2020, 2:35 AM
    Somewhat perplexed by the error messages from the Kotlin Native compiler when trying to build a KLib that targets linuxArm32Hfp. Below are the errors:
    e: /home/napperley/repos/gui_vista/guivista-core/src/linuxX64Main/kotlin/org/guiVista/core/gobject_utils.kt: (37, 12): Type mismatch: inferred type is gulong /* = UInt */ but ULong was expected
    e: /home/napperley/repos/gui_vista/guivista-core/src/linuxX64Main/kotlin/org/guiVista/core/gobject_utils.kt: (52, 38): Type mismatch: inferred type is ULong but gulong /* = UInt */ was expected
    Appears as though these are the only compile errors. Seem to be close to building the library for the linuxArm32Hfp target. Are there some subtle differences with data types between arm32hf and x64 I should be aware of with Kotlin Native?
    a
    r
    • 3
    • 8
  • k

    Kavan

    01/21/2020, 11:43 AM
    My last question in slack channel. "Is it GOD level required to get 1.4.0-dev builds in IntelliJIDEA ??" Cause right now I'm feeling this. Outside IntelliJIDEA everything complies well with git downloaded builds. Lookes like IntelliJIDEA need to reach sage mode or supersain level. I wasted my 4 days in getting 1.4.0 on IntelliJIDEA. (Dumb IDEA)
    m
    • 2
    • 2
  • p

    Patrick

    01/21/2020, 11:55 AM
    If I have a KN library code that uses coroutines and I want to call that code for example from C, how would I initialize the event loop? Right now I am getting this error:`kotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.`
    b
    k
    • 3
    • 7
  • p

    Patrick

    01/21/2020, 2:49 PM
    Has anyone ever tried reimporting a sharedLib using c interop? I tried to but ran into the issues shown in the picture.
    a
    • 2
    • 6
  • j

    jmullin

    01/21/2020, 4:00 PM
    Trying to understand some strange behavior with the K/N compiler. I have a case where, as I’m trying to debug through a confusing crash, adding a line of
    somePointer.rawValue
    corrects the issue. I’m not using the value, just putting that line as a statement. Are there some side-effects anyone is aware of to calling
    .rawValue
    on a pointer (implemented as a getter of
    value.toNativePtr()
    internally) that might explain what I’m seeing? I have a number of other things to debug into, but seeing this leads me to believe there’s more going on here that I need to understand first.
    k
    • 2
    • 4
Powered by Linen
Title
j

jmullin

01/21/2020, 4:00 PM
Trying to understand some strange behavior with the K/N compiler. I have a case where, as I’m trying to debug through a confusing crash, adding a line of
somePointer.rawValue
corrects the issue. I’m not using the value, just putting that line as a statement. Are there some side-effects anyone is aware of to calling
.rawValue
on a pointer (implemented as a getter of
value.toNativePtr()
internally) that might explain what I’m seeing? I have a number of other things to debug into, but seeing this leads me to believe there’s more going on here that I need to understand first.
k

kpgalligan

01/21/2020, 4:05 PM
Don’t know about the call. what’s the crash?
j

jmullin

01/21/2020, 4:26 PM
I think the root cause is something I’m doing wrong with JNI. Using it to call a Kotlin class in a JVM (strange use case, I realize), and getting a null result back from JNI (with no exception) where the method cannot return null.
This
.rawValue
call I alluded to above is in the implementation for another method which the JVM class calls via JNI on that side. It’s actually just a debug print message method used on both ends. I noticed that when I remove the call from the Kotlin/JVM source, this NPE situation happens. Introducing the call, even when the K/N implementation does nothing but take the
jstring
pointer and call
.rawValue
, causes everything to work properly. So something’s behaving strangely; I’m still hunting down stuff in the JNI bits I’m using, as I suspect it will end up being a GlobalRef vs LocalRef situation where the JVM has moved things out from under me. We’ll see.
👍 1
Follow-up: pretty sure I have the root cause addressed (it did end up being JNI GlobalRef shenanigans). Still a bit mystified why the call to
.rawValue
in K/N was fixing/masking the issues, but I at least have a path forward.
View count: 2