https://kotlinlang.org logo
Docs
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
  • m

    Martin Gagnon

    11/28/2019, 9:37 PM
    Hi, since upgrading to
    1.3.60
    , my iOS application crashes with one of the following assert from memory.cpp: - RuntimeAssert "Must be positive" - RuntimeAssert "cycle collector shall only work with single object containers" Sadly, I am not able to pinpoint or reproduce this issue with sample code. The only stack I have is the GarbageCollector failing. Any hints on what or how to investigate would be much appreciated. More info in the thread.
    o
    j
    • 3
    • 8
  • m

    Maurice Wingbermuhle

    11/29/2019, 10:34 AM
    I'm unable to resolve
    kotlin.native.concurrent.freeze()
    . Can anyone tell me what gradle imports I need? Cannot find it online...
    a
    s
    • 3
    • 17
  • k

    Kavan

    11/30/2019, 8:42 PM
    https://github.com/kavanmevada/kotlin-native-io
    d
    • 2
    • 2
  • b

    Burkhard

    12/01/2019, 6:30 AM
    What’s the best way to debug K/N? I’m using it for #advent-of-code for the first time. I started out by following https://kotlinlang.org/docs/tutorials/native/basic-kotlin-native-app.html and I also installed the “native debugging support” plugin for intellij. But when I try to create a “K/N Application” run configuration I can’t select any of my main functions. Also unlike with kotlin jvm they don’t get highlighted to run. I’m using the latest Intellij Ultimate version (2019.3)
    k
    • 2
    • 7
  • j

    jrod

    12/01/2019, 8:03 PM
    just refreshed my memory on stuff i haven’t looked at since ObjC days.
    Int
    on iOS is arch dependent and a bunch of articles seem to recommend using
    Int
    despite that all iPhones and iPads since 2013 and Watches since 2015 are now 64-bit. So….assuming I don’t want to burden API callers with the difference, is there a smart way to pass Swift
    Int
    down and handle it appropriately in the following case?
    let value = 5 // value is of type Int, so platform dependent
    
    print("before: \(value)")
    print("after: \(HelloKt.plusplus(value: value))")
    // Cannot convert value of type 'Int' to expected argument type 'Int32'
    in commonMain:
    fun plusplus(value: Int): Int {
        return value + 1
    }
    
    fun plusplus(value: Long): Long {
        return value + 1
    }
    map to
    + (int32_t)plusplusValue__:(int32_t)value __attribute__((swift_name("plusplus(value__:)")));
    + (int64_t)plusplusValue___:(int64_t)value __attribute__((swift_name("plusplus(value___:)")));
    respectively in iosMain:
    fun plusplus(value: integer_t): integer_t {
        return value + 1
    }
    
    fun plusplus(value: NSInteger): NSInteger {
        return value + 1
    }
    map to
    public typealias NSInteger = kotlin.Long // 64 bit signed
    public typealias integer_t = <http://kotlin.Int|kotlin.Int> // 32 bit signed
    respectively Any ideas?
    r
    • 2
    • 2
  • n

    napperley

    12/02/2019, 12:44 AM
    Is code completion for C libraries broken in the Kotlin 1.3.61 IntelliJ plugin? Using the following in the build.gradle.kts file:
    // ...
            compilations.getByName("main") {
                cinterops.create("ncurses") {
                    includeDirs("-L${System.getProperty("user.home")}/ncurses-6.1/include")
                }
            }
    // ...
    Would a symbolic link to a header file break code completion?
    • 1
    • 1
  • k

    Konstantin Petrukhnov

    12/02/2019, 8:01 AM
    What would be idiomatic way to create kotlin objects in iOS app (swift code), that could have mutable structures inside it? E.g. object, that have mutable map. Object will be passed multiple times between swift and kotlin, and will be alive for hours during application execution. Immutable objects are not suitable, as we need to modify up to 100K of such objects per second. Mutability needed only from Kotlin code. Now we use separate thread on Swift side, and we have lot of boilerplate code, to ensure, that all kotlin objects are accessed from single thread only. I'm looking into way to simplify it on swift side, and allow pass these specific kotlin objects across entire app.
    o
    • 2
    • 3
  • n

    napperley

    12/04/2019, 12:34 AM
    The Kotlin Native compiler (Konan) is outputting a boat load of warnings relating to the gtk3 mappings. What do these warnings mean?
    konan_warnings.txt
    a
    • 2
    • 2
  • n

    napperley

    12/04/2019, 3:11 AM
    Found a memory leak checker that will output issues if any are found. Below is a example:
    Memory leaks detected, 1 objects leaked!
    Use `Platform.isMemoryLeakCheckerActive = false` to avoid this check.
    k
    a
    • 3
    • 4
  • k

    Kavan

    12/04/2019, 6:23 PM
    Please contribute if you are good in big numbers https://github.com/kavanmevada/kotlin-native-bignum
    r
    a
    u
    • 4
    • 6
  • t

    tapchicoma

    12/04/2019, 9:57 PM
    From 1.3.60 release:
    Standard CLI library kotlinx.cli is shipped with the compiler distribution (GH-3215)
    Does it mean that I could use
    kotlinx.cli
    without adding any dependency to it?
    d
    o
    +2
    • 5
    • 7
  • k

    Kris Wong

    12/05/2019, 8:26 PM
    my iOS tests in one of my projects started SIGSEG'ing for some unknown reason, with no stack trace. has anyone run into this?
    • 1
    • 3
  • k

    Kris Wong

    12/05/2019, 8:51 PM
    Does anyone know why
    section
    and
    row
    are vals on
    NSIndexPath
    ? They are vars in Swift, and since they're vals in the native bindings, there's no way to set them.
    e
    • 2
    • 3
  • s

    Sam Schilling

    12/06/2019, 6:02 PM
    Is there an easy way to downgrade the K/N compiler?
    d
    • 2
    • 5
  • s

    Sam Schilling

    12/06/2019, 6:06 PM
    I updated to 1.3.60 and now it’s saying my module is invalid due to incompatible K/N libraries (they were compiled with 1.3.5x I believe)
    d
    s
    t
    • 4
    • 9
  • t

    tapchicoma

    12/07/2019, 9:30 PM
    What is the best way to load test data from some file for native test? In JVM I would just put it into
    res
    folder and then use
    Classloader#getResourcesAsStream()
    , but it is not available in native target.
    o
    • 2
    • 1
  • b

    bootstraponline

    12/08/2019, 9:44 PM
    Has anyone used
    kotlinx.coroutines.runBlocking
    on iOS? https://github.com/bootstraponline/run_blocking/blob/master/src/commonMain/kotlin/example/Common.kt https://github.com/bootstraponline/run_blocking/blob/master/src/iosMain/kotlin/example/RunBlocking.kt I have a simple example that compiles to an iOS framework. iOS hangs on
    kotlinx.coroutines.runBlocking
    and never returns. On the JVM, runBlocking works as expected.
    r
    b
    • 3
    • 13
  • n

    napperley

    12/09/2019, 1:46 AM
    The Linux version of Kotlin Native 1.3.60 is missing: https://github.com/JetBrains/kotlin-native/releases/tag/v1.3.60
    r
    • 2
    • 2
  • q

    qian

    12/09/2019, 4:38 PM
    Some of you (@roamingthings for example 🤗) came to my KotlinConf talk of Kotlin Native running on Rasbperry Pi and thank you for all the feedbacks. Just want to share my slides for those who weren’t there! https://speakerdeck.com/jinqian/native-on-raspberry-pi-62f5c937-9e28-434f-98d2-15e776a0a101
    🥧 1
    📰 3
    ⛰️ 3
    👍 10
    ✂️ 3
    r
    • 2
    • 2
  • c

    Cristián Arenas

    12/09/2019, 5:53 PM
    Hello folks, do you know how to enable bitcode on a staticlib?
    k
    a
    • 3
    • 12
  • s

    spierce7

    12/09/2019, 6:51 PM
    One of the talks at Kotlinconf mentioned that enums and sealed classes don’t translate well to Swift, and that by using them you lose compile errors when not covering all enum cases with a switch statement etc. One of the suggested solutions was to write Swift enum wrappers for them. I’m curious if there is a ticket for this that I can follow, or some other proposed solution that’s planned?
    b
    • 2
    • 2
  • r

    Robert

    12/10/2019, 12:04 PM
    I would like to export my dependency to the shared lib, so I can use it in C. It is about the bignum lib. Any clue why it is not included in the output? <https://gist.github.com/RdeWilde/5fb125cd3b69d49ea483e8a824f32708> Line 66 should've done the trick, but I don't think it is executed, or at least not included in the output header file. I used this as a reference: <https://github.com/JetBrains/kotlin-native/issues/3571>
    i
    a
    • 3
    • 11
  • r

    Robert

    12/10/2019, 6:01 PM
    Is there a smart way to extend the exported structs? I would like to add a few additional things, like user defined conversion:
    auto ionspinlib = libmylib_symbols()-><http://kotlin.root.com|kotlin.root.com>.ionspin;
    auto KBigInteger = ionspinlib.kotlin.bignum.integer.BigInteger;
    
    class CBigInteger : libmylib_kref_com_ionspin_kotlin_bignum_integer_BigInteger { // KBigInteger
    public:
        CBigInteger(long amount) : KBigInteger.BigInteger(amount) {} // << PROBMLEM
    //    {
    //        big = KBigInteger.BigInteger(amount);
    //    }
        operator long() const { return 10l; }
    };
    
    CBigInteger amount = 10l;
    long longAmount = amount;
    it seems like I can't use the dot-notation in the constructor call
    KBigInteger.BigInteger
    • 1
    • 1
  • a

    allanxp4

    12/11/2019, 3:33 AM
    Hi, Is there any support for kotlin-native on Linux ARM32 soft-float ABI? I tested, and it runs fine on both ARM64 and ARM32 hardfp, but the libraries and OS on the embedded device i'm planning to use it are compiled to ARM32 softfp (specifically ARMv5 EABI). I dug a little on the source code, and based on this file https://github.com/JetBrains/kotlin-native/blob/master/konan/konan.properties there's in fact no support. If there's no support, how would I be able to add it? Thanks!
    a
    • 2
    • 1
  • r

    ribesg

    12/11/2019, 10:29 AM
    message has been deleted
    b
    k
    s
    • 4
    • 3
  • r

    ribesg

    12/11/2019, 1:46 PM
    Can’t you use
    platform
    code in the
    iosMain
    sourceSet that gets generated by adding the
    ios()
    target? If you can’t, why does it generates it anyway?
    k
    a
    l
    • 4
    • 21
  • p

    Prateek Grover

    12/11/2019, 2:02 PM
    Hey All, I am making a multiplatform library. On the iOS side, i was able to selectively perform linkTask using buildTypes parameter in framework (inside target.binaries). But it is still compiling for all targets. How do I selectively compile using build type?
    s
    • 2
    • 5
  • r

    ribesg

    12/12/2019, 10:15 AM
    Any reason this is not upvoted? Does this really not cause any problem to anyone? What’s the reason for this? https://youtrack.jetbrains.com/issue/KT-23529
    k
    • 2
    • 6
  • a

    Andreas Jost

    12/12/2019, 1:46 PM
    If I try to do a switch in Swift on a KotlinEnum and provide a case for each constant, the compiler gives an error that switch must be exhaustive and it needs a default clause. Is that a limitation of the interop or will it be different in future?
    j
    • 2
    • 1
  • k

    kpgalligan

    12/12/2019, 9:39 PM
    I’m trying to debug a compile fail. In the past I’ve attached a debugger to do that, but it seems that in recent builds it no longer stops at breakpoints. Process here: https://medium.com/@kpgalligan/debugging-kotlin-natives-compiler-3cba9daec076. Wondering if more current builds strip debug info?
    e
    • 2
    • 3
Powered by Linen
Title
k

kpgalligan

12/12/2019, 9:39 PM
I’m trying to debug a compile fail. In the past I’ve attached a debugger to do that, but it seems that in recent builds it no longer stops at breakpoints. Process here: https://medium.com/@kpgalligan/debugging-kotlin-natives-compiler-3cba9daec076. Wondering if more current builds strip debug info?
To give the use case, the framework compiler is falling over with an llvm error, but there is no indication of what it was trying to process at the time. Debugging may not help, but it has with other things in the past. I’m currently stripping code and rerunning in the hopes that I get some insight, but that’s super, super slow
e

Elena Lepilkina

12/13/2019, 6:24 AM
Gradle propery
kotlin.native.disableCompilerDaemon=true
probably can help to use debugger.
k

kpgalligan

12/13/2019, 3:39 PM
Didn’t work on first try but I’ll poke around some more. Thanks.
View count: 4