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

    spierce7

    08/05/2020, 8:22 PM
    So why is Kotlin/native moving away from ARC? It seems like Swift gets good enough performance, and having a cycle collector on top of it surely isn’t a dramatic hinderance. In my companies performance benchmarks for real-world mobile tasks, we were seeing Kotlin and Swift perform within 1X of each-other.
    b
    g
    • 3
    • 8
  • a

    aleksey.tomin

    08/06/2020, 9:47 AM
    How can I use windows
    AdvertisingManager
    https://docs.microsoft.com/en-us/uwp/api/windows.system.userprofile.advertisingmanager ? I didn't find AdvertisingManager or UserProfile ...
    s
    • 2
    • 1
  • s

    salomonbrys

    08/10/2020, 11:27 AM
    Hey Guys, Kotlin/Native throws the following exception in my project (when using interop with ObjC):
    Blocks with non-reference-typed return value aren't supported (v)
    According to the apple documentation (https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100),
    v
    stands for
    void
    , which makes sense because the block in question (in this instance, the last parameter of
    nw_connection_receive
    ) returns void. Anyone has heard of this?
    • 1
    • 1
  • d

    Dominaezzz

    08/10/2020, 5:43 PM
    https://youtrack.jetbrains.com/issue/KT-40975 Vote if you're interested. 🙂
    s
    n
    s
    • 4
    • 8
  • a

    Anuj

    08/11/2020, 6:49 PM
    Hey Guys , I am trying out this Kotlin/Native sample and I get error
    "Skipping stdlib as its a pre 1.4 library; Could not find stdlib"
    when running assemble : https://github.com/JetBrains/kotlin-native/tree/master/samples/gtk . any idea how can i get version of stdlib that will work
    s
    • 2
    • 3
  • s

    SrSouza

    08/12/2020, 7:32 PM
    Hi folks, anyone knows if is possible to create Gnome Shell Extensions with Kotlin Native?
    😍 1
    k
    r
    s
    • 4
    • 5
  • a

    atsushi-koshikizawa

    08/13/2020, 9:32 AM
    Has anyone encounted as this? and did you solve it? https://kotlinlang.slack.com/archives/C0B8H786P/p1597217057008500
    a
    • 2
    • 2
  • p

    Paul Idstein

    08/13/2020, 11:51 AM
    Hi, we’re trying to tackle down a GC / heap corruption linked to object graph transfer issue originated from K/N on iOS. We have a custom K/N compiled to add TRACE_MEMORY. Is CLion actually a support IDE to do K/N runtime development?
    s
    • 2
    • 2
  • t

    ThomasD

    08/13/2020, 3:25 PM
    Hey guys, would anyone know how to get device model name in K/N? Something like this: https://stackoverflow.com/questions/11197509/how-to-get-device-make-and-model-on-ios
    s
    n
    • 3
    • 6
  • g

    Guy Dupont

    08/13/2020, 7:23 PM
    Hello! My team is working on a K/N library and we're wondering if we'll ever be able to get it to run on the Hololens 2. I know that Windows ARM64 is not yet a target, and my searches indicate that it's not really on the radar yet (pls correct me if I'm missing something). So a few questions: Is anyone else interested in this as a target platform? Does anyone have an idea of how crazy of a lift this would be?
    a
    • 2
    • 4
  • s

    serebit

    08/16/2020, 10:31 PM
    What's the status of C++ interop? I'd like to use Kotlin/Native and Qt for a GUI, as I'm currently using GTK+, but I don't know of a way to make that work.
    n
    m
    +2
    • 5
    • 8
  • s

    serebit

    08/17/2020, 10:52 PM
    Not sure how stupid this question is, but how would I go about statically linking glibc for a K/N executable? Is there a way to do so that doesn't involve specifying all the glibc headers in a cinterop def?
    d
    • 2
    • 3
  • t

    Tijl

    08/18/2020, 2:34 PM
    https://github.com/Kotlin/kotlinx.coroutines/commit/97acea199f9f673c2b0164763142d352f04109ef
    😂 1
    👍 4
    j
    • 2
    • 2
  • s

    Susheel

    08/18/2020, 6:02 PM
    Does kotlin-native work on apple watch frameworks? I heard there was an issue with this last year.
    :yes: 2
    n
    • 2
    • 2
  • j

    Jurriaan Mous

    08/19/2020, 8:12 AM
    I love being able to use native libraries within a hierarchical structure with the KLIB Commonizer. But as I develop a library sharing code over multiple Darwin (iOS/macOS etc) platforms I need to be able to develop inside nativeDarwinMain source set. In the current documentation it says it is not yet possible. Which causes my IDE to not interpret my code while it works in compile. Will the support for using native libraries at higher levels be supported soon? Or is there a technical barrier holding this back? About the limitations: https://github.com/JetBrains/kotlin/blob/1.4.0/native/commonizer/README.md My project with shared code over the Apple platforms. (still uses own appleMain setup instead of nativeDarwinMain) https://github.com/marykdb/rocksdb-multiplatform/tree/kotlin-1.4
    a
    • 2
    • 2
  • a

    altavir

    08/19/2020, 10:56 AM
    The main problem I have when adding native targets is the speed of tests. For some reason they take tremendous amount of time. For example, I am recomiling kotlinx-io fork and tests take more than 1 hour (JVM and both JS take about 2 minutes alltogether). Are there ways to fix that?
    a
    e
    i
    • 4
    • 26
  • s

    Shalaga44

    08/19/2020, 1:10 PM
    is there any way to interop c++ to native ? i tried to use
    wx
    but I got class error 😂😂😂😂
    Exception in thread "main" java.lang.Error: /usr/local/include/wx-3.1/wx/buffer.h:19:1: error: unknown type name `class'
    	at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
    	at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:1003)
    	at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:992)
    	at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:91)
    	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:266)
    	at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:72)
    	at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
    	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:19)
    	at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:37)
    
    > Task :cinteropInteropNative FAILED
    m
    k
    • 3
    • 3
  • a

    aleksey.tomin

    08/19/2020, 3:40 PM
    I’ve update MPP project with ktor to 1.4 When I build debug executable - all OK.
    $ ./gradlew linkAppDebugExecutableMacos
    ...
    BUILD SUCCESSFUL in 1m 14s
    But when I build release executable - I have error:
    $ ./gradlew linkAppReleaseExecutableMacos
    ...
    
    > Task app:linkAppReleaseExecutableMacos
    error: Linking globals named 'knifunptr_libcurl0_curl_strequal': symbol multiply defined!
    
    > Task :app:linkAppReleaseExecutableMacos FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:linkAppReleaseExecutableMacos'.
    > Process 'command '/Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
    ...
    $ ./gradlew --version
    ------------------------------------------------------------
    Gradle 6.6
    ------------------------------------------------------------
    
    Build time:   2020-08-10 22:06:19 UTC
    Revision:     d119144684a0c301aea027b79857815659e431b9
    
    Kotlin:       1.3.72
    Groovy:       2.5.12
    Ant:          Apache Ant(TM) version 1.10.8 compiled on May 10 2020
    JVM:          14 (Oracle Corporation 14+36-1461)
    OS:           Mac OS X 10.15.6 x86_64
    (I try to use jdk 1.8, 11, 14)
    What can I do?
    s
    • 2
    • 2
  • c

    caffeine

    08/19/2020, 11:55 PM
    Hello. I try to write mpp library for work with ssl. How I must work with openssl? I can do one of two: * build from source and put result static library to my git project * build openssl using clang included in konan. I mean I will put in git openssl source, and write build script in gradle. And then openssl will build during build main library What of 2 cases I must use? Maybe JetBrains has officially recommends some methods in this case?
    a
    d
    • 3
    • 3
  • i

    Iaroslav Postovalov

    08/20/2020, 5:33 AM
    Are there any ways to implement a concurrent queue in K/N?
    r
    k
    • 3
    • 4
  • r

    ribesg

    08/21/2020, 11:28 AM
    @Artyom Degtyarev [JB] sorry for the ping, but I’ve got this issue ( https://youtrack.jetbrains.com/issue/KT-39801 ) while being stuck on Kotlin 1.3.6x for other reasons… Is the workaround published for other Kotlin versions, or is it possible to do so? Or is the workaround source code opened somewhere I can clone, change the version and publish locally? Thanks We’re going to upgrade to Kotlin 1.4 but probably not anytime soon (a few weeks to a few months from now), so a definitive fix is not mandatory, if you have a better idea of how I can make things “just work” in the meantime, like putting some header somewhere, I don’t know My issue:
    Showing Recent Issues
    [...}project-cinterop-MaterialComponents.klib-build/kotlin/framework/MaterialComponents/MaterialComponents.kt: (39, 23): Unresolved reference: UIAxis
    Thanks!
    👀 1
    a
    • 2
    • 8
  • c

    caffeine

    08/22/2020, 12:07 AM
    Hello! Using clang included into konan I build openssl. And then when I try to link openssl and my kotlin-native project on macos I got error like this:
    _rsaz_1024_red2norm_avx2", referenced from:
          _RSAZ_1024_mod_exp_avx2 in libcrypto.a(rsaz_exp_1940672638.o)
      "_ecp_nistz256_gather_w5", referenced from:
          _ecp_nistz256_points_mul in libcrypto.a(ecp_nistz256_-493816618.o)
    ld: symbol(s) not found for architecture x86_64
    How I can fix it? Maybe I must pass special arguments to clang when I compile openssl? Now I pass
    --target=x86_64-apple-macos
    and
    -march=x86-64
    to clang.
    s
    • 2
    • 1
  • m

    Marc Knaup

    08/22/2020, 2:48 PM
    Are there any plans to make
    .freeze()
    a common function so that I don’t have to add my own multiplatform implementations in every single multiplatform library that I create?
    ➕ 5
    a
    • 2
    • 2
  • s

    saket

    08/22/2020, 4:06 PM
    Same! At the very least,
    kotlinx.atomicfu
    should provide them. Here’s a related request: https://github.com/Kotlin/kotlinx.atomicfu/issues/135
    k
    • 2
    • 1
  • i

    Iaroslav Postovalov

    08/22/2020, 8:49 PM
    I have experienced a cinterop problem: in this file, https://gist.github.com/666796f4cc82870187e680c6c887abe7, it ignored 2 functions:
    CZMQ_EXPORT int
        zloop_reader (zloop_t *self, zsock_t *sock, zloop_reader_fn handler, void *arg);
    and
    CZMQ_EXPORT int
        zloop_timer (zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, void *arg);
    Is it a known problem, or I should leave an issue on YouTrack?
    s
    • 2
    • 5
  • b

    basher

    08/23/2020, 12:27 AM
    Anyone else get this <x> is not bound error upgrading to 1.4 https://youtrack.jetbrains.com/issue/KT-41321?
    • 1
    • 1
  • p

    Paul Woitaschek

    08/23/2020, 7:19 AM
    I’m struggling with linking multiple gradle modules together. I have 3 gradle modules that I want to merge into a single ios framework. How would I do that? Right now I have created an
    ios
    gradle module that just depends on the 3 modules:
    kotlin {
      sourceSets {
        named("iosMain") {
          dependencies {
            api(project(":percent-distribution"))
            api(project(":podcast"))
            api(project(":units"))
          }
        }
      }
    }
    But that produces no frameworks
    a
    r
    • 3
    • 18
  • i

    Iaroslav Postovalov

    08/25/2020, 7:02 AM
    Hi! I'm trying to use commonizer for project with targets configured like
    a
    a
    l
    • 4
    • 26
  • i

    Iaroslav Postovalov

    08/25/2020, 8:55 AM
    Seems, the commonization is not possible because literally no targets except linux ones have any platform libraries
    • 1
    • 1
  • a

    aleksey.tomin

    08/25/2020, 12:31 PM
    I want to use
    mimalloc
    memory manager - https://kotlinlang.org/docs/reference/whatsnew14.html How have I pass
    -Xallocator=mimalloc
    by gradle (kts) configuration? In kotlin-native source code I’ve found the 4 different ways and nothing works.
    a
    • 2
    • 4
Powered by Linen
Title
a

aleksey.tomin

08/25/2020, 12:31 PM
I want to use
mimalloc
memory manager - https://kotlinlang.org/docs/reference/whatsnew14.html How have I pass
-Xallocator=mimalloc
by gradle (kts) configuration? In kotlin-native source code I’ve found the 4 different ways and nothing works.
a

Artyom Degtyarev [JB]

08/25/2020, 12:39 PM
Have you tried using
freeCompilerArgs
option?
a

aleksey.tomin

08/25/2020, 12:41 PM
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
...
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions.freeCompilerArgs += "-Xallocator=mimalloc"
…
$ ./gradlew build
...
* What went wrong:
Task with name 'compileKotlin' not found in root project 'kotlin-native'.
a

Artyom Degtyarev [JB]

08/25/2020, 12:42 PM
I meant something like described in this paragraph, but with other compiler flag.
a

aleksey.tomin

08/25/2020, 12:57 PM
it works, thank you!
View count: 26