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

    subin s v

    11/22/2018, 6:56 AM
    Is it possible to create single ios framework that contains X64, Arm32 and Arm64 in single framework package.. The below gradle code produces 3 separate frameworks.
    Single_ios_framework.groovy
    l
    j
    s
    • 4
    • 8
  • a

    Antonio Gisondi

    11/22/2018, 9:44 AM
    Hi, i have a problem with kotlin-native project, when I change target.presets from
    linuxX64
    to
    linuxArm32Hfp
    I receive this errror
    Unable to find a matching configuration of org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.0.1
    v
    • 2
    • 2
  • m

    Matej Kormuth

    11/22/2018, 9:50 PM
    Is is possible to set up travis ci with kotlin native?
    t
    m
    • 3
    • 2
  • s

    Sam

    11/23/2018, 6:02 AM
    Theoretical question, if one was to use kotlin native to create something like a connection pool is that possible? My thought immediately was to see what I could do with workers. However any time I start to wrap the
    Worker.execute
    method at all, I'm confronted with:
    kotlin.native.concurrent.Worker.execute must take an unbound, non-capturing function or lambda
    o
    • 2
    • 10
  • j

    Jaroslav

    11/23/2018, 8:33 AM
    Help needed. I can’t create NSTimeZone (from ios) on kotlin side. I’m trying it like this:
    NSTimeZone().initWithName(tzName = "UTC")
    but get nullpointerexception:
    Uncaught Kotlin exception: kotlin.NullPointerException
            at 0   greeting                            0x0000000103deb2e2 kfun:kotlin.Exception.<init>()kotlin.Exception + 50
            at 1   greeting                            0x0000000103deb212 kfun:kotlin.RuntimeException.<init>()kotlin.RuntimeException + 50
            at 2   greeting                            0x0000000103deb192 kfun:kotlin.NullPointerException.<init>()kotlin.NullPointerException + 50
            at 3   greeting                            0x0000000103dea4db ThrowNullPointerException + 59
            at 4   greeting                            0x0000000103dd757a kfun:org.greeting.Product.iosSpecificOperation()kotlin.String + 298
    s
    • 2
    • 2
  • l

    ldavin

    11/23/2018, 9:58 AM
    Hi there. I’m using kotlin-multiplatform to create a library, compiled to a jvm target (Android) and kotlin-native target (ios). On the native side (on iOS), I’m trying to use the kotlin code as a traditionnal mobile library (“injecting” the stuff in a ViewController and calling it from a background thread). I’m getting an IncorrectDereferenceException when calling my kotlin object from the background. I’ve found and read the IMMUTABILITY.md and CONCURRENCY.md but it doesn’t help me understand what I have to do to make my code work. Could I get any hints from you ? This is the kind of code I’m writing (simplified)
    -.kt
    o
    t
    • 3
    • 2
  • d

    danielbahe

    11/23/2018, 1:54 PM
    I have a function with kotlin and i like to call specific platform code from there. Is possible to import both platform libraries? I need a conditional to check which platform is running?
    o
    n
    s
    • 4
    • 7
  • s

    Sam

    11/23/2018, 3:47 PM
    Hey guys! I’m generating and publishing a .klib library artifacts using kotlin/native for the following ios targets:
    components.main {
        targets = ['ios_arm64', 'ios_x64']
        outputKinds = [KLIBRARY]
        baseName = "kotlinmultiplatformstorage-ios"
    
        dependencies {
            cinterop("KeychainWrapper"){
                packageName "com.netguru.keychainWrapper"
                includeDirs {
                    allHeaders "./KeychainWrapper.framework/Headers"
                }
                linkerOpts "-F${projectDir}"
            }
        }
    }
    As the result I have the following artifacts built:
    * kotlinmultiplatformstorage-common
    * kotlinmultiplatformstorage-android
    * kotlinmultiplatformstorage-ios
    * kotlinmultiplatformstorage-ios_debug_ios_arm64
    * kotlinmultiplatformstorage-ios_debug_ios_x64
    Next, I’m trying to use in the sample app configured using
    kotlin-multiplatform
    plugin with the following gradle build script:
    plugins {
        id 'kotlin-multiplatform' version '1.3.0'
    }
    kotlin {
        targets {
            final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64
    
            fromPreset(presets.android, 'android')
            fromPreset(presets.iosArm64, 'ios') {
                compilations.main.outputKinds('FRAMEWORK')
            }
        }
        
        configurations {
            compileClasspath
        }
    
        task packForXCode(type: Sync) {
            final File frameworkDir = new File(buildDir, "xcode-frameworks")
            final String mode = System.getenv('CONFIGURATION')?.toUpperCase() ?: 'DEBUG'
    
            inputs.property "mode", mode
            dependsOn kotlin.targets.ios.compilations.main.linkTaskName("FRAMEWORK", mode)
    
            from { kotlin.targets.ios.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
            into frameworkDir
    
            doLast {
                new File(frameworkDir, 'gradlew').with {
                    text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
                    setExecutable(true)
                }
            }
        }
    }
    tasks.build.dependsOn packForXCode
    When building sampleapp project I’m having the following error thrown:
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_Keychain", referenced from:
          objc-class-ref in combined.o
    ld: symbol(s) not found for architecture arm64
    error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
    Do you have any idea what can possibly be wrong with this config?
    s
    • 2
    • 2
  • p

    pajatopmr

    11/23/2018, 4:08 PM
    I am attempting to use Kotlin Native on Linux, Windows and MacOS for a command line app where files are manipulated via cinterop. Given a String path, how can I determine if the path is a valid directory? I can see how to get a “stat” buffer but I cannot determine yet how to manipulate the st_mode field. A link to some sample code would be the ideal response. The crux seems to be in finding an S_ISDIR macro or in finding the bit pattern values associated with the st_mode field.
    o
    • 2
    • 4
  • a

    alec

    11/25/2018, 3:44 AM
    is it possible to name the output
    .framework
    file? I used to do this in the old dsl:
    sourceSets {
      main {
        component {
          baseName.set("MultiPlatformProject") // Changes the name of the output .framework file
          target 'ios_arm64', 'ios_x64'
          outputKinds = [FRAMEWORK]
        }
      }
    }
    but unsure if there is an equivalent in the new multiplatform dsl
    t
    j
    i
    • 4
    • 7
  • c

    ckchen

    11/26/2018, 8:12 AM
    Currently we cannot use
    java.io.File
    , right? We have to use functions such as fopen() to deal with files. Is it possible that in the future there is a
    kotlin.io.File
    so no porting is needed?
    👍 1
    l
    p
    +3
    • 6
    • 5
  • s

    Sabrina Namur

    11/26/2018, 8:20 AM
    Hi, I want to use 'platform.posix.*', but Intellij shows an Error: unresolved reference: platform. Do I have to inject a dependency? From the documentation I assumed it works out of the box.
    • 1
    • 1
  • d

    Daniele B

    11/26/2018, 9:19 AM
    We are using Firebase, and we were wondering if Kotlin Native can successfully deal with Firebase Authentication on the different platforms
    n
    p
    a
    • 4
    • 4
  • s

    Sangeet

    11/26/2018, 11:18 AM
    Anyway to get variable from gradle i.e from local.properties and access that from kotlin native commonMain
    h
    • 2
    • 2
  • g

    galex

    11/26/2018, 1:27 PM
    Hello, I wonder if there’s a rough estimation to when Kotlin native will get out of beta? Is there a roadmap somewhere?
    o
    n
    • 3
    • 3
  • g

    galex

    11/26/2018, 3:35 PM
    Another question, is Kotlin Native impacted in any way by Swift version changes? iOS devs tell me it could be unsuitable for an iOS project because Swift changes a lot in every version, and they don’t want to be dependent on kotlin native to have to update its libraries we would build. WDYT?
    r
    s
    • 3
    • 4
  • k

    kpgalligan

    11/26/2018, 7:52 PM
    Before I get too deep in the weeds with something that won't work, can the multiplatform plugin handle native dependencies in the form of local files?
    -.pl
    n
    a
    • 3
    • 8
  • y

    yoavst

    11/26/2018, 8:26 PM
    Can I use Kotlin native for OS development (Cool side project)? I remember hearing it is possible to compile Kotlin native to run without OS, but can't find any info about it on the docs.
    🇳🇴 2
    c
    • 2
    • 1
  • y

    yuya_horita

    11/27/2018, 2:11 AM
    https://github.com/JetBrains/kotlin-native/commit/6fe37a00c5ec27dabf84b9ebf39618207d1e18f2 thank you🙏
    s
    • 2
    • 1
  • s

    Sam

    11/27/2018, 9:01 AM
    I’m struggling with building iOS framework using kotlin native + cinterop. Case: Building iOS framework using ‘kotlin.platform.native’ plugin with an ObjC library (framework) generated for multiple platforms, linked using cinterop. .def file:
    language = Objective-C
    headers = Keychain.h KeychainQuery.h KeychainWrapper.h
    compilerOpts = -framework keychainwrapper
    linkerOpts = -F/path/ -framework keychainwrapper
    excludeDependentModules = true
    build.gradle cinterop dependency declaration:
    dependencies {
            cinterop("KeychainWrapper"){
                packageName "com.company.keychainWrapper"
                includeDirs {
                    allHeaders "./KeychainWrapper.framework/Headers"
                }
                linkerOpts "-F${projectDir}"
                compilerOpts "-F${projectDir}"
            }
        }
    Problem: After linking Objective-C framework generated for both architectures (x86_64 and arm64) cinterop is letting us to use only the first linked one, so if the x86_64 is the first listed in the build settings - it will work only for that architecture. Effect: I can use the framework on simulator only when using it in my iOS project. The project doesn’t build for the real device Do you have an idea how this can be fixed? (xcode log in comment)
    s
    s
    i
    • 4
    • 16
  • j

    JoakimForslund

    11/27/2018, 12:52 PM
    If you run
    printf("Event: %s Value: %s ", event, value);
    in a cinterop *.def file it does not seem to be sent to the stream output, is there anyway to make it show up the same way as println(..) does from commonCode ?
    s
    • 2
    • 13
  • e

    elect

    11/27/2018, 2:38 PM
    openjfx 11 is on path
    o
    g
    • 3
    • 3
  • e

    elect

    11/27/2018, 2:48 PM
    gui appears to be broken, got it running by
    gradle build
    in cli
    o
    • 2
    • 2
  • j

    Jamie Lynch

    11/27/2018, 7:34 PM
    I've generated an Obj-C framework from a Kotlin multiplatform module and am using it in an iOS app via Swift. If I wanted to convert the Swift code in that module to Kotlin, would it be a case of linking that framework using cinterop?
    s
    • 2
    • 2
  • m

    msink

    11/28/2018, 9:30 AM
    I published version 0.1.0 of https://github.com/msink/kotlin-libui Now it can be used as normal dependency in
    kotlin-miltiplatform
    project, see sample in https://github.com/msink/hello-libui IDEA/CLion can be used for development. Update: now on
    jcenter()
    , sample updated.
    🤘 5
    :kotlin: 3
    👍 15
    e
    o
    +2
    • 5
    • 16
  • m

    msink

    11/28/2018, 5:09 PM
    BTW, when I asked to include it to jcenter, got message:
    Request to include the package '/msink/kotlin-native/libui' in 'jcenter'
    
    Hi, 
    
    We can only approve one path for a single package.
    Please let us know which path prefix you would like to include.
    
    Thanks, 
    JFrog Support
    Yes, it is multiplatform package, really 3 separate packages for Linux/Windows/Mac... Don't know what they want from me.
    e
    k
    • 3
    • 9
  • c

    Carl Hickman

    11/28/2018, 7:04 PM
    Anyone know if Kotlin Native has been tried out on the Fuschia OS?
    n
    k
    o
    • 4
    • 3
  • t

    tylerwilson

    11/28/2018, 7:55 PM
    So I just installed the release version of AppCode 2018.3, and it marked the Kotlin/Native plugin as incompatible. So I uninstalled it, expecting perhaps a new version. But I cannot find any plugin listed in the the Marketplace. Can we expect an updated K/N plugin for AppCode?
    o
    • 2
    • 1
  • l

    Landerl Young

    11/29/2018, 7:29 AM
    Can K/N maintains compact binary size like C++ does (when K/N reflection is disable)? The TypeInfo struct has lots of fields:
    struct TypeInfo {
        const TypeInfo* typeInfo_;
        ClassNameHash name_;
        int32_t instanceSize_;
        const TypeInfo* superType_;
        const int32_t* objOffsets_;
        int32_t objOffsetsCount_;
        const TypeInfo* const* implementedInterfaces_;
        int32_t implementedInterfacesCount_;
        const MethodTableRecord* openMethods_;
        uint32_t openMethodsCount_;
        const FieldTableRecord* fields_;
        int32_t fieldsCount_;
        ObjHeader* packageName_;
        ObjHeader* relativeName_;
        int32_t flags_;
        const ExtendedTypeInfo* extendedInfo_;
    };
    So, which of them are related to reflection, which are not. AFAIK: 1.
    supreType_
    and
    implementedInterfaces_
    are useful for runtime type cast check. 2.
    vtable
    (not listed but comes after the TypeInfo struct) is useful for virtual methods calling. 3.
    openMethods_
    is useful for interface method calling. But some of the rest fields like
    packageName_
    ,
    relativeName_
    ,
    name_
    ,
    instanceSize_
    ,
    objOffsets_
    ,
    fields_
    , etc. seem to be reflection related? Should they be moved into
    ExtendedTypeInfo
    so them can be omitted when reflection is disabled? May I get your help @olonho ? Thanks.😀
    o
    • 2
    • 6
  • y

    yuya_horita

    11/29/2018, 9:41 AM
    PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES.
    in https://github.com/JetBrains/kotlin-native/blob/c1a41c9dc4c69d008da0c5a83ace00f63b84dec4/runtime/src/main/kotlin/kotlin/native/Annotations.kt#L47
    d
    • 2
    • 2
Powered by Linen
Title
y

yuya_horita

11/29/2018, 9:41 AM
PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES.
in https://github.com/JetBrains/kotlin-native/blob/c1a41c9dc4c69d008da0c5a83ace00f63b84dec4/runtime/src/main/kotlin/kotlin/native/Annotations.kt#L47
d

Denis Shurygin

11/30/2018, 11:30 AM
Hope they think about better way to do the same. Current implementation of concurrency lead to hard restrictions in crossplatform code.
y

yuya_horita

11/30/2018, 3:09 PM
Yes
View count: 3