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

    12/20/2018, 11:33 AM
    A bit of opinionated question, say I'm publishing a library (KLIB) wrapping a native library like curl, glfw, ssh, etc. Should I be using the static or dynamic variant of the library? Can and should both be done in a single KLIB?
    o
    n
    • 3
    • 3
  • i

    Ivan

    12/20/2018, 12:56 PM
    is it possible to cast NSArray into CFArrayRef(need to cast to CFArray) in ios specific module? getting cast exception for some reason
    o
    s
    • 3
    • 2
  • j

    jdiaz

    12/20/2018, 2:51 PM
    Has anyone had troubles linking libcurl in osx? I'm trying to use the example but I can't make it compile it in clion, even though the cinterop worked nice and I see libcurl.klib in the gradle dependencies
    d
    • 2
    • 8
  • p

    pajatopmr

    12/20/2018, 10:24 PM
    I am trying to use coroutines in a Kotlin native project and am having trouble with the dependency spec. I’m using
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.11"
    which Gradle is not happy with. What is the right version to use? And is Maven Central the correct repository to use?
    g
    m
    • 3
    • 12
  • t

    thevery

    12/21/2018, 8:25 AM
    def binary = kotlin.targets.iosSim.compilations.test.getBinary('EXECUTABLE', 'DEBUG')
    doesn't work anymore in eap-52, what it the new way to get test binary?
    m
    i
    • 3
    • 3
  • n

    nestserau

    12/21/2018, 10:21 AM
    From what I understood,
    runBlocking
    is not available for iOS, but what’s the proper way to unit test suspend functions on iOS Simulator then?
    j
    b
    • 3
    • 6
  • l

    Lucas

    12/23/2018, 5:43 AM
    Should we link the compiled
    .klib
    file manually when using the Gradle plugin? I'm trying to call a function named
    reverse
    written in C from a Kotlin code, but running
    ./gradlew runProgram
    show the error below.
    > Configure project :
    Kotlin Multiplatform Projects are an experimental feature.
    
    > Task :cinteropReverseLinux UP-TO-DATE
    
    > Task :linkReleaseExecutableLinux
    /home/lucas/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld: error: undefined symbol: reverse
    >>> referenced by ld-temp.o
    >>>               /tmp/konan_temp3346060776025102598/combined.o:(reverse_kniBridge0)
    error: /home/lucas/.konan/dependencies/clang-llvm-6.0.1-linux-x86-64/bin/ld.lld invocation reported errors
    
    > Task :linkReleaseExecutableLinux FAILED
    Sample: https://github.com/lucasvalenteds/kotlin-native-cinterop
    m
    • 2
    • 3
  • p

    pajatopmr

    12/23/2018, 6:17 PM
    Kotlin Native is truly kind of major cool for the notion of building platform independent desktop apps. However, “deploy” is somewhat unclear to me as I do not believe there is a platform independent package management tool (ala Homebrew or Gems or such). Is anyone aware of such a tool or strategy towards making one?
    e
    s
    +2
    • 5
    • 8
  • y

    yuya_horita

    12/26/2018, 9:34 AM
    class MainDispatcher: CoroutineDispatcher() {
        override fun dispatch(context: CoroutineContext, block: Runnable) {
            dispatch_async(dispatch_get_main_queue()) { block.run() }
        }
    }
    o
    e
    • 3
    • 12
  • m

    Matej Kormuth

    12/26/2018, 11:21 PM
    Why does the following code return true for Float comparison and false in some cases for objects?
    data class B(val a: Float, val b: Float)
    
    data class A(val a: Float, val b: Float) {
        override fun equals(other: Any?): Boolean {
            if(other is A) {
                return a == other.a && b == other.b
            }
            return false
        }
    }
    
    fun main(args: Array<String>) {
        println(0.0f == -0.0f) // true
        println(B(0.0f, 0.0f) == B(0.0f, -0.0f)) // false
        println(B(2f, 4f) == B(2f, 4f)) // true
        println(A(0.0f, 0.0f) == A(0.0f, -0.0f)) // true (workaround)
    }
    o
    u
    • 3
    • 11
  • s

    spierce7

    12/26/2018, 11:22 PM
    @olonho It sounds like some changes are being considered for the kotlin/native concurrency model driven by the kotlinx.coroutine library? I'm very interested to hear what options you guys are considering.
    t
    o
    k
    • 4
    • 4
  • m

    mikehearn

    12/27/2018, 9:41 PM
    Are there instructions anywhere on how to get an IDE with auto-completion for libraries set up? i own both Ultimate and CLion but can't get more than syntax highlighting working 😞
    d
    o
    • 3
    • 9
  • k

    kyonifer

    12/27/2018, 10:19 PM
    is it possible to tell k/native via gradle plugin where to find cinterop klibs on a remote maven repo without experimental gradle metadata enabled? With metadata enabled it finds the cinterop klibs on bintray fine but this causes other issues with the jvm platform projects. Disabling metadata leads to
    error: compilation failed: Could not find "XX-cinterop-YY" in [...]
    . Is metadata enabled required to resolve cinterop klibs uploaded to a maven repo?
    d
    n
    m
    • 4
    • 17
  • s

    Sam

    12/28/2018, 4:09 AM
    I just ran across something odd. I have a MPP app that I'm working on that also has an MPP library. In the app's generated iOS framework I wanted to expose a property from a type in the library. Something like:
    class Exports() {
        var libraryTypeA: LibaryTypeA? = null
    }
    //LibraryTypeA is declared in library as extending NSOBject
    class LibraryTypeA(): NSObject(): AnObjCDelegate { 
        //Some methods
    }
    The generated header in the app framework was exposing the type of
    libraryTypeA
    as NSObject and not
    LibraryTypeA
    . The reason I was inheriting from NSObject was because I was implementing a delegate declared in an ObjC Framework (CoreBluetooth). I'm able to work around this by encapsulating the delegate into an internal object. Is there a way to force the exported type declaration to be
    LibraryTypeA
    instead of
    NSObject
    ?
    o
    l
    • 3
    • 3
  • y

    yuya_horita

    12/28/2018, 10:07 AM
    Thanks to developers here, especially developers answered my questions 🙇, I could write some articles about Kotlin/Native from iOS developer perspectives. (I am iOS developer) I hope it will help some developers 🙏 https://medium.com/@yuyaHorita/kotlin-native-ios-da067d361b7c
    🍎 4
    👍 12
    o
    s
    • 3
    • 3
  • c

    charleskorn

    12/29/2018, 10:39 AM
    Kotlin/Native newbie question… I’m trying to work with a library that defines all string parameters as
    unsigned char *
    . How do I take a Kotlin string and convert it to that? (cinterop has given the parameter the type
    CValuesRef<UByteVar>
    , which means I can’t just use
    .cstr
    or
    .wcstr
    )
    d
    n
    • 3
    • 6
  • s

    serebit

    12/30/2018, 5:25 PM
    Could we potentially get syntax checking and autocompletion for other platforms besides the one we’re developing on? Like autocompletion for mingw on linux systems
    ➕ 9
    o
    • 2
    • 7
  • j

    jeremy

    12/30/2018, 7:27 PM
    build.gradle: commonMainImplementation "io.ktor:ktor-client-core:$ktor_version" iosArm64MainImplementation "io.ktor:ktor-client-ios:$ktor_version" iosX64MainImplementation "io.ktor:ktor-client-ios:$ktor_version"
    d
    • 2
    • 8
  • l

    lsk

    12/31/2018, 10:32 AM
    Could you advice how to iterate over array of
    const passing_t**
    in C and converted to Kotlin native as
    passing: CPointer<CPointerVar<passing_t>>?
    ? I don't know how to get sizeOf the array to itterate
    d
    • 2
    • 5
  • l

    lsk

    01/01/2019, 7:55 PM
    Is there any lib that can help me to write REST API server in kotlin-native? Something like Ktor, Spark etc
    👍 1
    o
    • 2
    • 1
  • s

    Strum355

    01/02/2019, 4:58 PM
    Is there a usecase for kotlin native outside of interaction with C etc
    s
    o
    a
    • 4
    • 3
  • c

    chadmorrow

    01/02/2019, 5:28 PM
    The only thing I really like about the Go language is that your programs compile to a neat, native binary that's simple to distribute and run. I don't like much else about the language though and would love to use something like Kotlin Native as a Go replacement. Is Kotlin Native meant to be, or could grow into being, a competitor with Go in that sense?
    s
    k
    o
    • 4
    • 4
  • c

    coletz

    01/02/2019, 9:32 PM
    is there a way to expose any ios lib from objc/swift to kotlin native? Just like the foundation library and other base ios libs which are already available with kotlin native
    s
    o
    o
    • 4
    • 7
  • l

    lsk

    01/03/2019, 3:19 PM
    What IDE can I use to understand kotllin native code and code generated from C library. Ideally the C code as well. I haven't tried new Gradle plugin with 1.3.11, still using makefile
    d
    m
    • 3
    • 8
  • l

    lsk

    01/03/2019, 5:01 PM
    well, but does Idea or Clion resolves all dependencies like
    import platform.posix.*
    ? I am testing on Clion and it does not. It does see generated code, this is great
    g
    m
    • 3
    • 3
  • s

    Sam

    01/05/2019, 10:43 PM
    In some Kotlin Native code I'm implementing some methods defined in an ObjC protocol. A problem I'm having is that that two of the methods basically have the same signature but different parameters names. I need to implement both as they'll be called by the ObjC code at different times for different events. When I try to do this the compiler complains about conflicting overloads. Is there a way around this? For reference the protocol is defined in CoreBluetooth's
    CBCentralManagerDelegate
    https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate. The conflicting methods are
    didDisconnect
    and
    didFailToConnect
    .
    o
    d
    • 3
    • 5
  • l

    lsk

    01/06/2019, 7:14 PM
    I need an advice with Gradle multiplatform plugin. Using CInterops support I add a native library and should how can I reference it from main project? It keeps saying
    ...ld.lld: error: undefined symbol...
    to what I have in native lib
    d
    m
    • 3
    • 12
  • s

    sdeleuze

    01/06/2019, 10:15 PM
    Hey, can we expect significant compilation time improvements in 2019? https://github.com/JetBrains/kotlin-native/issues/733
    🙏 13
    s
    • 2
    • 4
  • b

    Brian

    01/07/2019, 3:02 PM
    Is the compiler flag
    -Xembed-bitcode
    actually supported as stated in the FAQs? With the Kotlin Gradle plugin v1.3.10 I still get a warning, suggesting that the bitcode is not embedded. This was asked earlier: https://kotlinlang.slack.com/archives/C3SGXARS6/p1540494962000100
    o
    s
    • 3
    • 8
  • k

    kpgalligan

    01/07/2019, 7:30 PM
    Blog posts explaining native state and concurrency. We’ve been teaching folks internally and I’ve been making verbal promises for months, so here’s the first bits: https://twitter.com/kpgalligan/status/1082295480569212929
    💯 2
    :kotlin: 1
    👍 14
    c
    r
    • 3
    • 7
Powered by Linen
Title
k

kpgalligan

01/07/2019, 7:30 PM
Blog posts explaining native state and concurrency. We’ve been teaching folks internally and I’ve been making verbal promises for months, so here’s the first bits: https://twitter.com/kpgalligan/status/1082295480569212929
💯 2
:kotlin: 1
👍 14
c

coolcat

01/08/2019, 4:04 PM
Checked out the StrangerThreads sample from Github. Tests run fine from the command line but I can’t seem to run them from within IntelliJ — this is a problem I have had with other KN projects. Anyone else having any luck with that?
k

kpgalligan

01/08/2019, 4:08 PM
I can’t get that to work either. You can run specific tests with command line switches
#Runs specific test. Pass in test name. ./gradlew linkTestDebugExecutableMacos ./build/bin/macos/test/debug/executable/test.kexe --ktest_regex_filter=.$1.
bash script
c

coolcat

01/08/2019, 4:21 PM
Is this a general problem with KN projects that the tests don’t work well in IntelliJ? Trying to make it work is a time sink for me
k

kpgalligan

01/08/2019, 4:23 PM
I would guess it’s a temporary situation. Lots of stuff happening. Interactive debugging would be on my wish list. I did get lldb command line debugging to work, but am mostly logging
👍 1
r

russhwolf

01/08/2019, 4:26 PM
You can get part-way by adding an IDE run configuration to run the gradle commands. For most of my multiplatform projects I have a run config for
clean build check
. For pure native all this really gets you though is a quicker keyboard shortcut instead of typing a command.
👍 1
View count: 2