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

    Dominaezzz

    09/14/2018, 11:31 PM
    I'm not sure where to report this. I keep getting
    error: compilation failed: C:\Users\Dominic\KotlinNativeProjects\kotlin-sqlite\build\konan\libs\mingw_x64\ksqlite.klib: The process cannot access the file because it is being used by another process.
    , when I build Kotlin/Native project in CLion. Can only fix it by restarting.
    o
    • 2
    • 1
  • s

    spierce7

    09/15/2018, 2:40 AM
    What version of Kotlin are we going to see a compiler plugin API that is public across all Kotlin compilers?
    g
    e
    • 3
    • 8
  • b

    bulwinkel

    09/15/2018, 7:41 AM
    I have clion with the latest Kotlin/native plugin but can't get the idea to give any completion information
    d
    d
    • 3
    • 5
  • d

    Denis Shurygin

    09/15/2018, 12:25 PM
    Anybody explain me how to handle mutable singletons in common module. Here is the changes that I add into kotlin-mpp-example: https://github.com/KamiSempai/kotlin-mpp-example/commit/35627af6d4d3e1e0b7824adb708e9e0906db4a3c I add a new one object Factory2 in common module that has lazy initialization of its properties. On android it works fine but in iOS i get InvalidMutabilityException. Ok, I know that in Kotlin Native all singletons are freezed and I should use annotation ThreadLocal to make it mutable atleast in one thread. BUT this is common module. I can't use anything from Kotlin Native. Does any practices that helps to solve such problems in common modules? Right now I only see that this immutability cut a lot of code which can be moved into common module.
    o
    k
    • 3
    • 7
  • t

    tunedal

    09/15/2018, 3:46 PM
    Can I tie a StableRef to a MemScope so that it gets disposed automatically when the MemScope ends?
    • 1
    • 1
  • d

    Dmitry Kandalov

    09/16/2018, 11:48 AM
    Is there a way to bind native object lifetime to a kotlin object?
    o
    • 2
    • 4
  • m

    marcinmoskala

    09/16/2018, 2:41 PM
    I got: warning: inliner failed to obtain function declaration: kotlin.properties.Delegates.observable Is it a problem?
    o
    • 2
    • 2
  • d

    Dominaezzz

    09/16/2018, 8:22 PM
    Can anyone who can be bothered, explain why my Virtual Table test works on Linux(WSL) but not on Windows? It ends with
    Process finished with exit code -1073741819 (0xC0000005)
    I think it might be a linking issue but I'm not experienced enough to figure it out. https://github.com/Dominaezzz/kotlin-sqlite
    m
    o
    • 3
    • 8
  • y

    yusuf3000

    09/17/2018, 6:19 AM
    I’ve tried building my kotlin native project using Xcode 10 GM and I’m getting a compilation error:
    targeted OS version does not support use of thread local variables in _kfun:com.TestEnum.$OBJECT.$get-VALUES()kotlin.Array<com.TestEnum> for architecture x86_64
    * What went wrong:
    Execution failed for task ':platform-ios:compileDebugIos_x64KotlinNative'.
    > Process 'command '/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
    Anyone know how to solve this?
    o
    • 2
    • 5
  • a

    alec

    09/17/2018, 7:04 PM
    is it possible to interop with objc/swift code that isn’t platform artifacts? I see info like https://blog.jetbrains.com/kotlin/2017/11/kotlinnative-v0-4-released-objective-c-interop-webassembly-and-more/ to interop with platform libraries like UIKit and Foundation but I’m wondering if theres a way to interop with other framework artifacts or just header files that are part of my source directory? I could have sworn I saw it somewhere…
    o
    • 2
    • 5
  • k

    kyonifer

    09/17/2018, 8:21 PM
    is there some way to set the component name in the new gradle DSL? before we could do
    library('foo')
    , but with the experimental DSL it seems to make
    components.main.name
    read only
    t
    • 2
    • 3
  • s

    Sangeet

    09/18/2018, 6:55 AM
    I want to know whether kotlin native coroutines are supported in iOS or not. I heard that starting from kotlin 1.3, iOS is supported.
    g
    • 2
    • 3
  • k

    Konstantin Petrukhnov

    09/18/2018, 9:13 AM
    Going back to my problems with types 🙂 Is there any way to have compiled interface to be [UInt8] and not [MyLibInt]? I tried also with val myVal: List<Int>; and in primary constructor: MyClass(myVal: List<Int>), but it still compiled to [MyLibInt]
    s
    • 2
    • 1
  • j

    Jaroslav

    09/18/2018, 11:10 AM
    Hi everyone! I’m trying to run Kolin Native examples and when I run
    ./gradlew dist crossDist
    in root folder of the project, I get:
    kotlin-native-master/runtime/src/main/cpp/Interop.cpp:22:10: fatal error: 'ffi.h' file not found
    #include <ffi.h>
             ^~~~~~~
    1 error generated.
    MacOS 10.13.6, XCode 9
    o
    • 2
    • 2
  • j

    Jaroslav

    09/18/2018, 11:52 AM
    One more general question: The situations is that we already have backend and android app written in kotlin. They share a library with a lot of business logic. Now I’m thinking how it would be best to approach iOS app - should we go for including common lib and writing UI, DB and stuff with swift or is it safe to write UI stuff with kotlin too?
    o
    • 2
    • 5
  • d

    Dominaezzz

    09/18/2018, 5:54 PM
    So I'm writing an OpenGL Loader generator for Kotlin and each function looks something like this.
    private val glShaderSource: CPointer<CFunction<(GLuint, GLsizei, CPointer<CPointerVar<GLcharVar>>?, CPointer<GLintVar>?) -> Unit>> get() = glfwGetProcAddress("glShaderSource")!!.reinterpret()
    With another function to call it properly of course. Since, I'm not relying on c_interop to do any magic for me at the border between Kotlin and C. What types are actually allowed at the border? Everything in
    kotlinx.cinterop.*
    ?
    o
    • 2
    • 1
  • j

    Jaroslav

    09/19/2018, 11:38 AM
    I’ve made an example app from a tutorial on github: https://github.com/JetBrains/kotlin-native/blob/master/MULTIPLATFORM.md iOS app works ok, but I can’t find a way to add dependency from maven to be included in my framework. Is there something I’m missing? When I add
    implementation
    to dependencies, I get an error
    Could not find method implementation() for arguments [...] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
    g
    r
    • 3
    • 3
  • d

    dmuratshin

    09/19/2018, 6:55 PM
    Hi, Is it known problem that latest CLION doesn't see attached interop library to hello world example? (but compiles/run fine) also CLION doesn't show readable compiler/linker errors
    d
    • 2
    • 3
  • d

    David

    09/20/2018, 11:39 AM
    Does anyone know when the Kotlin/Native plugin for AppCode will support 0.9? Or is there some preview version to download?
    o
    t
    • 3
    • 2
  • j

    Jaroslav

    09/20/2018, 12:15 PM
    Does kotlin native support coroutine channels? https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md#channels-experimental
    e
    d
    v
    • 4
    • 4
  • r

    r4zzz4k

    09/20/2018, 1:18 PM
    I'm trying to write code which maps some Kotlin values into cinteropped ones, and stumbled upon this one trying to process array (for primitives copying values via
    output.pointed.value = input
    , for structures I was going to copy bytes and needed size of generic
    CVariable
    ). The stuff that breaks:
    import kotlinx.cinterop.*
    
    inline fun <reified T : CVariable> sizeOf(value: T) = sizeOf<T>()
    
    fun process(value: Any) {
    	when (value) {
    		is Int -> 4
    		is CVariable -> sizeOf(value)
    	}
    }
    
    fun main() = Unit
    The error:
    error: compilation failed: native variable class deserialized class CVariable must have the companion object
    
     * Source files: sample.kt
     * Compiler version info: Konan: 0.9.1 / Kotlin: 1.3.0
     * Output kind: PROGRAM
    
    exception: java.lang.IllegalStateException: native variable class deserialized class CVariable must have the companion object
    s
    • 2
    • 5
  • i

    Ivan

    09/21/2018, 5:14 AM
    Hey! How do I get a
    CValuesRef<CPointerVar<ByteVar>>?
    to pass to a native function?
    s
    o
    • 3
    • 5
  • s

    spierce7

    09/22/2018, 3:54 AM
    Also, what's the current version of Gradle I should be using for Kotlin/native? The last I saw was several versions ago with Gradle 4.7
    o
    • 2
    • 1
  • m

    mikehearn

    09/22/2018, 4:21 PM
    you MUST use EXACTLY kotlin 1.3-M1 if you are using Kotlin JVM in the rest of your project. no other version works at all, not -m2 not any of the release candidates
    o
    • 2
    • 1
  • f

    fabianterhorst

    09/22/2018, 6:29 PM
    which is the recommended ide for developing with kotlin native for ios? I have tried clion 2018.3 eap but unable to find an compatible kotlin/native plugin. It needs to work with mpp.
    o
    a
    • 3
    • 2
  • m

    mikehearn

    09/22/2018, 7:27 PM
    btw, the above remains true for the currently unreleased 0.9.2 - it doesn't seem to work with the latest 1.3 EAP 😞 (different error though). AFAICT this means I can't easily use Kotlin/Native right now in a project that also uses Kotlin/JVM because the plugins end up interfering with each other, and the IDE has updated me to the latest version of the Kotlin plugin on the EAP. I suppose I could try to downgrade my IDE to -m1 but, eh
    o
    • 2
    • 3
  • h

    hmole

    09/23/2018, 10:38 AM
    Are there any progress for better handling C keywords in Kotlin?
    @NativeName
    maybe?
    e
    o
    • 3
    • 5
  • h

    hmole

    09/23/2018, 11:10 AM
    How can I include two Kotlin frameworks in an app? I'm getting
    Only one Kotlin framework can be loaded currently
    . version 1.3.0-rc57
    r
    o
    • 3
    • 4
  • m

    minamoto-jb

    09/24/2018, 7:37 AM
    @channel Kotlin/Native team is pleased to announce release v0.9.2 of our toolchain. This is a major release, including the following features: * Support Xcode 10.0 * iOS 9.0 is the minimal supported version for all targets * Swift interop improvements * Support shared top level values of some immutable types (i.e. String and atomic references) * Support release Kotlin 1.3.0 Binaries can be downloaded from the following links: https://download.jetbrains.com/kotlin/native/builds/releases/0.9.2/macos/kotlin-native-macos-0.9.2.tar.gz https://download.jetbrains.com/kotlin/native/builds/releases/0.9.2/linux/kotlin-native-linux-0.9.2.tar.gz https://download.jetbrains.com/kotlin/native/builds/releases/0.9.2/windows/kotlin-native-windows-0.9.2.zip GitHub release page is https://github.com/JetBrains/kotlin-native/releases/tag/v0.9.2
    :kotlin: 2
    🔥 5
    🎉 19
    y
    • 2
    • 2
  • a

    Aman Alam

    09/24/2018, 8:52 AM
    Folks, I am just starting with Kotlin on Android.. And I wanted to learn a cross platform tech too. I was wondering if Kotlin Native requires me to write the UI in iOS specific language, what’s the real value that Kotlin Native gives me over things like Flutter or ReactNative?
    o
    • 2
    • 1
Powered by Linen
Title
a

Aman Alam

09/24/2018, 8:52 AM
Folks, I am just starting with Kotlin on Android.. And I wanted to learn a cross platform tech too. I was wondering if Kotlin Native requires me to write the UI in iOS specific language, what’s the real value that Kotlin Native gives me over things like Flutter or ReactNative?
o

olonho

09/24/2018, 10:24 AM
It doesn’t require, it allows to write it in either Swift or Kotlin, with tight platform integration vs. fixed porting layer in other solutions you mention
View count: 3