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

    JoakimForslund

    04/26/2019, 8:46 AM
    I think I have run into this issue: https://stackoverflow.com/questions/2567498/objective-c-categories-in-static-library/9224606 while trying to convert a iPhone staticLibrary to klib, where the objective-C code uses categories to extend dictionary methods. Is there currently any way to resolve this with kotlin native (without having to add extra linker options inside the xcode project later)? The issue I currently get when running my ios Target:
    -[__NSDictionaryM bsg_ksc_safeSetObject:forKey:]: unrecognized selector sent to instance 0x281678f60
    s
    12 replies · 2 participants
  • m

    msink

    04/26/2019, 10:27 AM
    I feel dumb - what is best way to get C string allocated in nativeHeap from Kotlin String?
    j
    o
    +1
    6 replies · 4 participants
  • n

    Nezteb

    04/27/2019, 5:57 PM
    Is Kotlin Native a good choice for a cross-platform CLI tool? I see that it can target pretty much everything. But I don’t need a GUI or anything. Initially I was going to use Go but I figured I should at least research Kotlin Native.
    :yes: 6
    1 reply · 1 participant
  • p

    pandawarrior

    04/28/2019, 3:35 AM
    I am trying to use Kotlin Native Framework in my Swift files in AppCode but there is no autocompletion. But it works in XCode in the same project. Is there any way to make it work?
    v
    6 replies · 2 participants
  • t

    Thomas

    04/28/2019, 6:19 PM
    I was trying out the new CocoaPods support for Kotlin/Native, so I can include Firebase as a pod on my iOS project. Unfortunately, it looks like subspecs are not supported, which prevents me from adding the Firebase pod. Is there a way to get this working? Or is there an issue I can follow regarding subspecs?
    s
    o
    8 replies · 3 participants
  • t

    tapchicoma

    04/29/2019, 2:41 PM
    How to add dependency to
    XCTest
    framework? Just
    iosX64 {
            compilations.getByName("main") {
                val xctestinterop = cinterops.create("XCTest")
            }
        }
    would work?
    d
    r
    9 replies · 3 participants
  • s

    Slackbot

    04/29/2019, 11:23 PM
    This message was deleted.
    o
    1 reply · 2 participants
  • k

    kpgalligan

    04/30/2019, 12:01 AM
    If making a background thread call from Swift, does that method need to call
    initRuntimeIfNeeded
    or will that be called by interop code (same question for a property instead of a method)
    -.swift
    o
    1 reply · 2 participants
  • y

    yusuf3000

    04/30/2019, 10:08 AM
    We currently have an iOS app using K/N live in production 😄 Unfortunately, in rare instances (and something we can not reproduce in house) our customers get this crash. A block seems to be released by iOS which in turn causes a lambda contained within our K/N framework to be released on a background thread, something we have no control over. I think it’s related to this github issue: https://github.com/JetBrains/kotlin-native/issues/2052 We are also using K/N v1.3.30. We also tried freezing this lambda, but we require some mutations to take place, so we couldn’t go do this in the end. Would anyone be able to help with this?
    o
    3 replies · 2 participants
  • o

    oleksandr.stepanov

    04/30/2019, 1:17 PM
    Hello everyone. I have another issue with Kotlin Cocoapods plugin. I have tried to add some Kotlin dependencies like ktor, coroutines and serialisation. And now XCode project build fails on the linking step with not finding dependencies error:
    :-1: e: /Users/oleksandr.stepanov/Documents/Kotlin/kotlin-native/samples/cocoapods/kotlin-library/src/commonMain/kotlin/model/WikiApi.kt: (3, 8): Unresolved reference: io
    /Users/oleksandr.stepanov/Documents/Kotlin/kotlin-native/samples/cocoapods/kotlin-library/src/commonMain/kotlin/model/WikiApi.kt: (4, 8): Unresolved reference: io
    /Users/oleksandr.stepanov/Documents/Kotlin/kotlin-native/samples/cocoapods/kotlin-library/src/commonMain/kotlin/model/WikiApi.kt: (5, 8): Unresolved reference: io
    ....
    I have pushed my changes in the fork: https://github.com/OlexandrStepanov/kotlin-native/tree/cocoapods-ktor-issue Help what could be wrong in Gradle scripts would be much appreciated. cc @svyatoslav.scherbina
    s
    2 replies · 2 participants
  • j

    JoakimForslund

    04/30/2019, 1:27 PM
    Am I missing something, or why can't I use embedBitcode on a staticLib while on framework I can?
    o
    1 reply · 2 participants
  • b

    basher

    04/30/2019, 5:31 PM
    Are there regularly deployed dev snapshot builds of K/N somewhere? I looked through various readmes and didn't see anything (sorry if I missed it)?
    d
    2 replies · 2 participants
  • s

    serebit

    04/30/2019, 7:47 PM
    Currently, kotlin/native Linux targets can be built on Windows and macOS. Is there any potential for the reverse, i.e. Windows or macOS targets being able to be built on Linux?
    d
    t
    +3
    14 replies · 6 participants
  • d

    David Stolarsky

    05/02/2019, 9:58 AM
    I followed the Multiplatform Project: iOS and Android tutorial. everything is working great, except I don't see how to access Android platform APIs from my
    androidMain/
    code. i try adding
    import platform.android.*
    , which i've seen in various examples online, but I get
    Unresolved reference: platform
    . I assume my
    build.gradle
    is misconfigured, any ideas what I'm missing?
    o
    1 reply · 2 participants
  • d

    David Stolarsky

    05/02/2019, 9:59 AM
    here's my
    build.gradle
    build_gradle.groovy
    r
    58 replies · 2 participants
  • k

    kpgalligan

    05/02/2019, 1:52 PM
    So, errors and iOS. Looking at https://github.com/JetBrains/kotlin-native/blob/master/OBJC_INTEROP.md, it mentions if we want to have an explicit throw check, add @Throws, but I have some more questions. If calling directly into kotlin code from swift (and presumably objc), on a method without @Throws, if the code throws an exception the app will crash. This is what I’d expect to happen. However… (to thread)
    l
    b
    +1
    11 replies · 4 participants
  • k

    kevin.cianfarini

    05/02/2019, 8:12 PM
    Is there a platform independent way of invoking a subprocess?
    d
    o
    13 replies · 3 participants
  • m

    Michael Bryant

    05/02/2019, 9:28 PM
    if i’m using a k/n dynamic library from C, is there a way to go from an
    Any
    struct to a primitive type? For example, if I know a particular instance of
    Any
    contains an int, how can i get it out of the
    Any
    struct? I tried
    int l = *(int *) kotlin_any.pinned;
    , which doesn’t appear to work
    o
    3 replies · 2 participants
  • t

    Thomas

    05/04/2019, 3:05 PM
    I'm looking for a way to use a CoAP lib on iOS in my Kotlin/Native code. I found a C library (https://github.com/obgm/libcoap) which does what I need. I don't have a lot of experience with C so this is quite new for me. Could anyone tell me if it would be possible to use this library in Kotlin on iOS using cinterop?
    d
    16 replies · 2 participants
  • d

    David Stolarsky

    05/05/2019, 7:21 AM
    i use
    () -> Unit
    to require a function that takes nothing and returns nothing. but to provide a function like this from Swift, the function has to return a
    KotlinUnit
    . is there a way to avoid that?
    🇳🇴 2
    🙁 1
    t
    1 reply · 2 participants
  • d

    David Stolarsky

    05/05/2019, 1:26 PM
    is it possible to convert a Kotlin
    ByteArray
    to Swift
    Data
    without copying every byte?
    j
    4 replies · 2 participants
  • s

    Slackbot

    05/06/2019, 10:06 AM
    This message was deleted.
    o
    1 reply · 2 participants
  • t

    Thomas

    05/06/2019, 12:35 PM
    What would be the best way to create an implementation for suspend functions in Swift/ObjectiveC? Suspend functions are not visible in the exported framework, this is because ObjectiveC does not have “suspend functions” (https://github.com/JetBrains/kotlin-native/issues/1684). I use suspend functions for showing a dialog (a dialog can return a result or be cancelled). For example the following View interface:
    interface View : MvpView {
        // shows a dialog which returns a String.
        suspend fun showDialog(): String
    }
    I’m not sure how I can implement this for iOS. I thought the following workaround would work:
    interface View : MvpView {
        // implement this in Android (Kotlin)
        suspend fun showDialog(): String = suspendCancellableCoroutine { showDialog(it) }
    
        // implement this in iOS (Swift)
        fun showDialog(cont: CancellableContinuation<String>): Unit = throw NotImplementedError()
    }
    This would allow me to use suspend functions from the calling code and the Android implementation, and just a normal function for iOS. However, it looks like default functions for interfaces are not supported. (https://github.com/JetBrains/kotlin-native/issues/2638) What would be the best way to solve this? Not use suspend functions at all?
    t
    s
    +1
    14 replies · 4 participants
  • s

    Shameek Sarkar

    05/06/2019, 12:47 PM
    Are channels supported for iOS yet? I keep getting a Typecast Exception when I push anything to a channel, and cant figure out what I am doing wrong.
    d
    s
    5 replies · 3 participants
  • d

    David Stolarsky

    05/07/2019, 5:43 AM
    linkMyLibReleaseFrameworkIos
    takes extremely long (multiple minutes) on my dev machine after a small change. i have like 2,000 lines of code. is this expected or is my build misconfigured?
    o
    5 replies · 2 participants
  • s

    serebit

    05/08/2019, 1:45 AM
    Correct me if I'm wrong, but there doesn't seem to be a way to call a non-static and capturing function on program exit in kotlin/native.
    o
    12 replies · 2 participants
  • d

    David Stolarsky

    05/08/2019, 3:42 AM
    is it true that not fully implementing a Kotlin interface in swift generates a compile time error, but not fully implementing an abstract base class only generates a runtime error when you try to call an unimplemented abstract function? is there a way to move that error into build time?
    s
    5 replies · 2 participants
  • h

    hmole

    05/08/2019, 5:47 AM
    Are
    x86
    and `x86_64`Android targets not supported? I'm looking at the sample https://github.com/JetBrains/kotlin-native/blob/master/samples/androidNativeActivity/build.gradle here and only seeing
    arm32
    ,
    arm64
    n
    b
    +3
    11 replies · 6 participants
  • p

    ptmt

    05/08/2019, 6:27 AM
    I’m seeing that printing a stack-trace (exception.printStackTrace()) on iOS blocks the main thread for up to 250ms (
    GetStackTraceThings
    ), is it worth trying to create stand-alone reproducible example?
    o
    2 replies · 2 participants
  • l

    lsk

    05/09/2019, 5:06 AM
    I am using ZMQ in my multiplatform project. It compiles fine on Linux, but on Windows it tries to compile for Linux as well and there are no path to zmq.h file and so files. Anz idea how to solve it? I see option 1, include zmq in my project to be present on Windows, option 2, not using build on Windows, but compile...Windows and link...Windows tasks. Or any better option is possible?
    m
    1 reply · 2 participants
Powered by Linen
Title
l

lsk

05/09/2019, 5:06 AM
I am using ZMQ in my multiplatform project. It compiles fine on Linux, but on Windows it tries to compile for Linux as well and there are no path to zmq.h file and so files. Anz idea how to solve it? I see option 1, include zmq in my project to be present on Windows, option 2, not using build on Windows, but compile...Windows and link...Windows tasks. Or any better option is possible?
m

msink

05/09/2019, 5:58 AM
You can configure build for host platform only - something like this: https://github.com/msink/hello-libui/blob/63e42ef9bd76d7f8c4dbff3f7fae5757e899c6a5/build.gradle.kts#L13
View count: 17