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

    albertgao

    01/18/2018, 8:47 PM
    What does the word
    konan
    stand for? Just the code of the kotlin native project? Project konan?
    ➕ 1
    m
    • 2
    • 2
  • a

    albertgao

    01/18/2018, 9:43 PM
    In terms of http request for Android and iOS, I suppose I need to use interface (
    expect
    in KN) to do the abstraction, and inject the platform implementation at runtime?
    o
    • 2
    • 1
  • b

    budioktaviyan

    01/19/2018, 10:09 AM
    guys, need your help. I’m facing this issue while building the
    kotlinconf-app
    o
    • 2
    • 10
  • b

    budioktaviyan

    01/19/2018, 10:09 AM
    :android:app:transformClassesWithDexForDebug
    Dex: Error converting bytecode to dex:
    Cause: Dex cannot parse version 52 byte code.
    This is caused by library dependencies that have been compiled using Java 8 or above.
    If you are using the 'java' gradle plugin in a library submodule add
    targetCompatibility = '1.7'
    sourceCompatibility = '1.7'
    to that submodule's build.gradle file.
        UNEXPECTED TOP-LEVEL EXCEPTION:
        java.lang.RuntimeException: Exception parsing classes
            at com.android.dx.command.dexer.Main.processClass(Main.java:781)
            at com.android.dx.command.dexer.Main.processFileBytes(Main.java:747)
            at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
            at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1689)
            at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
            at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
            at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
            at com.android.dx.command.dexer.Main.processOne(Main.java:695)
            at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
            at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)
            at com.android.dx.command.dexer.Main.run(Main.java:292)
            at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
            at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
        Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
            at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
            at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
            at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
            at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
            at com.android.dx.command.dexer.Main.parseClass(Main.java:793)
            at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
            at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1728)
            at com.android.dx.command.dexer.Main.processClass(Main.java:779)
    g
    v
    • 3
    • 7
  • l

    levcom

    01/21/2018, 7:50 PM
    What can replace KFunction.call(...) without reflection in Kotlin.Native?
    o
    • 2
    • 2
  • j

    jmullin

    01/22/2018, 4:46 PM
    So presently we can’t get a function pointer to a function that returns a struct by value. Two questions: is there a known workaround to this, and where does this feature sit on the priorities list (if anywhere currently)?
    o
    • 2
    • 10
  • n

    nyxcharon

    01/22/2018, 6:16 PM
    Is there a standard api for kotlin native listed online anywhere?
    g
    s
    s
    • 4
    • 3
  • c

    clifton

    01/22/2018, 7:21 PM
    Newbie here… I’m taking another stab at learning Kotlin native and I need help understanding how bindings work. When you run the cinterop tool it generates a .klib from the headers defined in the given .def file. Does the klib link to the native library dynamically or statically? I don’t understand when/how the native library is resolved. Does it need to be in a special LD_LIBRARY path when running the final binary produced by kotlinc? Or does it somehow get compiled into the binary when running the kotlinc cmd?
    o
    • 2
    • 2
  • c

    clifton

    01/22/2018, 7:42 PM
    still for the dynamic libs how does the system know where to link at runtime? Do I set a LD_LIBRARY env var before running or is there a predetermined search path for each OS or…?
    g
    • 2
    • 1
  • a

    alexanderUV

    01/23/2018, 6:17 AM
    is there any plan to write a build system+package mgr for kotlin native like swiftPM?
    r
    g
    +2
    • 5
    • 7
  • w

    wakingrufus

    01/23/2018, 4:35 PM
    has anyone looked at making QT apps with kotlin/Native?
    s
    g
    +3
    • 6
    • 13
  • k

    kikitux

    01/24/2018, 1:50 PM
    not trying to take shorcuts, but in case someone can RTFM in the right direction:
    o
    • 2
    • 7
  • a

    alec

    01/24/2018, 3:49 PM
    are there any plans to generated
    .swiftmodule
    and
    .switftdoc
    as an alternative to the currently generated objc headers?
    o
    p
    • 3
    • 2
  • s

    spierce7

    01/25/2018, 5:28 AM
    It's been a little while since I've looked at kotlin-native, and was wondering at the status: 1. Does debugging work now? 2. If so does debugging from an iOS device work?
    ➕ 2
    o
    • 2
    • 1
  • s

    spierce7

    01/25/2018, 4:53 PM
    Is there any ETA for when kotlin-native will work with multi-platform projects, and when kotlin-native will be supported in the multi-platform libraries that kotlin has like
    kotlinx.serialization
    ?
    o
    • 2
    • 2
  • c

    clifton

    01/25/2018, 6:27 PM
    I’m a little further in my tinkering/understanding. I’m now trying to create a small Kotlin example using libcurl but I’m getting a runtime error:
    SFO1212474815A:easycurl 212474815$ kotlinc curl.kt -library curlklib -o kurl
    KtFile: curl.kt
    ld: warning: directory not found for option '-L/opt/local/lib'
    ld: warning: could not create compact unwind for _ffi_call_unix64: does not use RBP or RSP based frame
    SFO1212474815A:easycurl 212474815$ ./kurl.kexe
    Download from URL
    Error performing CURL download: CPointer(raw=0x10e711808)
    • 1
    • 9
  • j

    jkbbwr

    01/26/2018, 3:58 AM
    Anyone know why this line is not working
    val serverAddr = alloc<sockaddr_in>()
    o
    • 2
    • 3
  • c

    Czar

    01/26/2018, 10:57 AM
    Quick question. Is Kotlin Native CLion-only or IntelliJ IU supports it (will support it at some point) too?
    o
    s
    • 3
    • 4
  • d

    draciel

    01/26/2018, 11:58 PM
    Did someone compiled properly a code with vulkan api? cinterop properly generated bindings (IDE prompts vulkan methods, I am able to create vulkan structs etc) but during final compilation I get many undefined references errors.
    o
    • 2
    • 8
  • g

    gildor

    01/30/2018, 12:45 AM
    You should build against both platforms. But K/N doesn't support multiplatform projects yet.
    a
    i
    • 3
    • 2
  • a

    albertgao

    01/30/2018, 4:48 AM
    I want to declare a function type that returns nothing like
    var successCallback: (result: String) -> Unit
    , However the generated ObjC code is
    @property NativeLibsStdlibUnit*(^errorCallback)(NSString*);
    , I want to have a declaration at the swift side using something like this:
    var successCallback: (_ result: String) -> Void
    . Anything I did wrong? The official example are all return
    Any
    can’t find an example of returning
    Unit
    at the kotlin side which could be translated to
    Void
    in Swift side.
    s
    • 2
    • 1
  • k

    kikitux

    01/30/2018, 10:35 AM
    is there any kotlin/native example for suspended functions?
    o
    • 2
    • 4
  • a

    albertgao

    01/30/2018, 10:09 PM
    Are there any conditional compile strategies? Something like
    If (android) {a=andA} else if (ios) {a=iosA}
    . I want to use interfaces to separate some platform-specific logic, then compile them according to different platform
    o
    i
    • 3
    • 9
  • a

    albertgao

    01/31/2018, 1:47 AM
    How to setup the project dependencies for platform specific code? When I
    import platform.Foundation.*
    , IDEA said
    cant resolve platform
    . I think maybe it’s because I have not setup the
    dependencies
    in the
    build.gradle
    ? But can’t find them in the
    kotlin-conf
    and KN
    samples
    either, I can’t get the auto-completion there, but at least they seem to resolve the kotlin native libs without problem. Basically the same
    build.gradle
    . Anything I missed here?
    g
    o
    • 3
    • 15
  • g

    gildor

    02/01/2018, 5:49 AM
    There is a problem that CLion doesn’t work with Gradle, so you cannot build Android application from CLion
    a
    m
    r
    • 4
    • 26
  • k

    kikitux

    02/02/2018, 10:40 AM
    any pointer to get KN parsing json into data class ?
    o
    • 2
    • 3
  • r

    rootandy

    02/02/2018, 2:09 PM
    or if there is not alerady a possibility, maybe some plans?
    o
    • 2
    • 2
  • r

    rCorbellini

    02/05/2018, 2:40 PM
    Someone know where i can found a example of project for IOS, with a simple tutorial of how can compile and deploy?
    o
    • 2
    • 2
  • i

    ianbrandt

    02/06/2018, 7:19 AM
    Out of curiosity, how are unsigned types handled by Kotlin/Native? The docs just say, "All supported C types have corresponding representations in Kotlin: Signed, unsigned integral and floating point types are mapped to their Kotlin counterpart with the same width." (https://github.com/JetBrains/kotlin-native/blob/master/INTEROP.md) What happens if a native API returns an unsigned type with a value that is out of range for the corresponding signed type in Kotlin (e.g. an unsigned short with a value of 65535)?
    g
    o
    • 3
    • 3
  • s

    svyatoslav.scherbina

    02/07/2018, 9:07 AM
    @rootandy @Jacob It is partially possible, because Objective-C supports “lightweight generics”. But only for classes, not protocols. So we consider mapping type parameters of Kotlin classes to Objective-C generics as a possible feature, but are not working on it right now.
    👍 6
    s
    • 2
    • 3
Powered by Linen
Title
s

svyatoslav.scherbina

02/07/2018, 9:07 AM
@rootandy @Jacob It is partially possible, because Objective-C supports “lightweight generics”. But only for classes, not protocols. So we consider mapping type parameters of Kotlin classes to Objective-C generics as a possible feature, but are not working on it right now.
👍 6
s

Simone Civetta

02/07/2018, 1:28 PM
That would be a super important addition in my use cases, especially if you use a K/N
.framework
from swift
Because, as of now, specialized arrays in K/N become non-typed arrays in Swift
s

svyatoslav.scherbina

02/07/2018, 1:50 PM
Actually, exposing type of collection elements is much simpler than translating type parameters of arbitrary Kotlin class. We are working right now on more precise array types, among with supporting seamless passing of other Kotlin standard collections.
👍 1
View count: 5