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

    mbonnin

    11/16/2022, 11:27 AM
    Did something change in 1.8 in how to specify linker flags? We used to do
    compilation.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlite3")
    but it seems we now need
    binary.linkerOpts("-lsqlite3")
    ?
  • n

    napperley

    11/16/2022, 10:39 PM
    One use case has appeared where the cinterop commonizer fails. Using a Kotlin Native library from another Kotlin Native library, where the same C library is used. With the cinterop commonizer enabled in the library depending on the other library an error appears about a unresolved classifier from the C library, even though the Kotlin wrapper for the C library is provided by the dependency.
    a
    2 replies · 2 participants
  • n

    napperley

    11/18/2022, 1:57 AM
    After updating Kotlin to 1.7.21 in a Kotlin Native project, and running the linkCounterDebugExecutableLinuxX64 Gradle task the build fails with a bunch of Unable to compile C bridge errors. It appears as though there is a Kotlin regression with linking static library files, or the way static library files are setup in the build file has changed. Here is some Kotlin code that triggers one of the errors:
    public actual fun mainPaletteColor(paletteValue: UInt): Color = lv_palette_main(paletteValue).toColor()
    The
    lv_palette_main
    symbol exists in the liblvgl.a file. Below is the output after running `nm liblvgl.a | grep lv_palette_main`:
    U lv_palette_main
                     U lv_palette_main
                     U lv_palette_main
                     U lv_palette_main
                     U lv_palette_main
                     U lv_palette_main
    0000000000000777 T lv_palette_main
    1 reply · 1 participant
  • a

    Anmol Verma

    11/18/2022, 8:56 AM
    Hi Folks, I have generated a klib library with cinterop and it works in my tests but when i import this library in another project it doesn’t contain the framework files although it has the static library that I generated! Any ideas ?
    l
    r
    +1
    29 replies · 4 participants
  • h

    hfhbd

    11/18/2022, 11:22 AM
    How is it possible to create the xcframework but not to execute the metadata task? What is the difference between the tasks from compiler view?
    xcframework successfully written out to: clients/build/XCFrameworks/debug/clients.xcframework
    > Task :clients:linkReleaseFrameworkIosArm64
    > Task :clients:assembleReleaseIosFatFrameworkForClientsXCFramework SKIPPED
    > Task :clients:linkReleaseFrameworkIosSimulatorArm64
    > Task :clients:assembleReleaseIosSimulatorFatFrameworkForClientsXCFramework SKIPPED
    > Task :clients:assembleClientsReleaseXCFramework
    xcframework successfully written out to: clients/build/XCFrameworks/release/clients.xcframework
    > Task :clients:assembleXCFramework
    
    > Task :clients:compileIosArm64MainKotlinMetadata FAILED
    1 reply · 1 participant
  • a

    Anmol Verma

    11/18/2022, 4:13 PM
    What is
    symbol multiply defined!
    ? and how can i resolve this ? I am using a pod in a
    library project A
    and now i have declared the pod in my
    Main Project
    which uses this
    library A
    so that the framework is found in the runtime but the compilation fails with the following
    Compilation failed: Linking globals named 'knifunptr_cocoapods_GRPCClient8_TransportIDIsEqual': symbol multiply defined!
    k
    6 replies · 2 participants
  • a

    ankushg

    11/19/2022, 12:03 AM
    Does anyone have a decent way of running
    xcodebuild
    as a task from Gradle? I’ve got a suite of Swift tests that consume my KMP artifact, and I’d like to include them as a dependency of my
    check
    or
    test
    tasks, and have them run as part of a Gradle continuous build
    r
    3 replies · 2 participants
  • a

    andrew

    11/20/2022, 8:08 PM
    Does kotlin native support embedded arm targets? I’m guessing the size of stdlib in kotlin would be hefty
    h
    n
    +3
    19 replies · 6 participants
  • r

    Rohde Fischer

    11/22/2022, 3:54 PM
    is there a kotlin native way to have a
    SortedMap
    ? E.g., when I'm deserializing a
    json
    map where the order is important 🙂 It seems that
    Map
    happens to be sorted, but I assume it's the same as for Java - there is no guarantee it will stay that way, am I correct in that assumption? If so what can/should I do?
    e
    m
    12 replies · 3 participants
  • s

    Slackbot

    11/24/2022, 12:00 PM
    This message was deleted.
    m
    1 reply · 2 participants
  • a

    ayodele

    11/26/2022, 9:30 AM
    Hi, I thought the new memory model is enabled by default in Kotlin 1.7.20. But I still had to add the flag in Gradle properties.
  • u

    黄文和

    11/26/2022, 9:36 AM
    Under what circumstances will cinterop generate cnames.struct, I found the type declaration in cnames and can view it through knm decompilation
  • m

    Miroslav Sobotka

    11/26/2022, 10:12 AM
    Does anyone have any experience on how to provide the type of a numeric constant defined by a macro? Example: there is a function in the c library that takes Short Integer (16 bits) as a parameter. Next, a constant is defined via macro, so de facto without type. cinterop generates this constant as Integer (32 bits). So I have to use
    .toShort()
    every time I use it. Options: redefine each constant directly in the def file or subsequently in the kotlin code.
    u
    5 replies · 2 participants
  • h

    hfhbd

    12/01/2022, 5:24 PM
    Even with Kotlin 1.8.0 beta there is no context receiver support, is it?
  • k

    kevin.cianfarini

    12/04/2022, 2:31 PM
    Is my understanding of the framework
    isStatic
    option correct in that when embedded within cocoapods, dependencies would be statically linked to the output framework and the consuming iOS application wouldn't have to introduce that cocoapods dep?
    kotlin {
      cocoapods {
        framework {
          isStatic = true
        }
      }
    }
  • a

    Adam S

    12/04/2022, 5:11 PM
    I’m following the tutorial here but I’m not able to generate any files. What Gradle task should I run? What should I expect to see generated? https://kotlinlang.org/docs/native-app-with-c-and-libcurl.html
  • i

    itnoles

    12/04/2022, 11:05 PM
    How I can fix this? Fat frameworks are not supported for platform
    macos_x64
    h
    1 reply · 2 participants
  • f

    František Jeřábek

    12/05/2022, 12:32 PM
    I have created multiplatform library with some cinterop libraries for
    linuxArm64
    and
    linuxX64
    . I published the library to my local maven repo. Now when i try to use the library in some project on
    linuxX64
    the build goes fine, but when i try to compile for
    linuxArm64
    i get
    cannot find -l<library name>
    and bunch of
    undefined reference to <something>
    . The library has
    def
    file with different linker paths for each architecture and build of the library goes fine for all build targets. The problem is only when i try to use the published library. So i am wondering what might be wrong here ?
    n
    5 replies · 2 participants
  • l

    Landry Norris

    12/05/2022, 3:14 PM
    It looks like when I compile Kotlin/Native code, any global extension functions don’t get added to the Objective-C header. It seems like it would be possible to have
    __attribute__((objc_subclassing_restricted))
    __attribute__((swift_name("FooKt")))
    @interface FooKt : FooBase
    + (void) bar:(Baz) receiver
    @end
    but I don’t see this generated. I do see it if I make my extension function in an object, though.
    l
    5 replies · 2 participants
  • g

    Gavin Novate

    12/06/2022, 7:50 AM
    Kotlin Native performance is poor, the following are the results tested on Android and iOS using the KMM platform, is this as expected?
    val time = measureTime {
            repeat(10000) {
                floatArray = floatArrayOf(
                    1f, 0f, 0f, 0f,
                    0f, 1f, 0f, 0f,
                    0f, 0f, 1f, 0f,
                    0f, 0f, 0f, 1f
                )
            }
        }
        println("timeTest = $time")
    Logs
    # Android
    timeTest = 1.169792ms
    timeTest = 993.229us
    timeTest = 978.125us
    timeTest = 843.229us
    timeTest = 933.854us
    timeTest = 769.271us
    timeTest = 1.307812ms
    timeTest = 859.375us
    timeTest = 938.02us
    timeTest = 900us
    timeTest = 1.047396ms
    timeTest = 844.271us
    timeTest = 1.460417ms
    
    # iOS (iPhone 13 Pro)
    timeTest = 17.078459ms
    timeTest = 11.881083ms
    timeTest = 14.285167ms
    timeTest = 14.382958ms
    timeTest = 14.487708ms
    timeTest = 9.521209ms
    timeTest = 17.071583ms
    timeTest = 17.293083ms
    timeTest = 18.362084ms
    timeTest = 17.979125ms
    c
    l
    +3
    45 replies · 6 participants
  • s

    Seiya Kokushi

    12/06/2022, 8:09 AM
    Hi, I’m trying to migrate artifact generation to new experimental DSL,
    kotlinArtifacts
    . I found that new way doesn’t register
    embedAndSignAppleFrameworkForXcode
    gradle task. How can I execute
    embedAndSignAppleFrameworkForXcode
    task with new DSL? or tell me how to register the gradle task
    embedAndSignAppleFrameworkForXcode
    .
    k
    4 replies · 2 participants
  • j

    Jon Olson

    12/06/2022, 8:46 PM
    Hi, we have an issue with Kotlin Native linuxArm32Hfp .so producing
    CP15 barrier instruction
    errors on our Cortex a53 CPU ARMv8-A and our process is unable to load the .so at runtime - the process freezes. This issue did not occur on Kotlin 1.6.10 or earlier. The issue also is resolved by disabling the experimental memory model using
    kotlin.native.binary.memoryModel=experimental
    On the other hand, Kotlin 1.7.20 has the experimental memory model enabled by default, and KTOR library also requires it to be on and we depend on KTOR. I plan on creating a YouTrack ticket but would like to start by asking here first in case I get lucky.
    n
    7 replies · 2 participants
  • p

    Pat Teruel

    12/07/2022, 5:31 AM
    Hi Everyone. I can see some people have already raised the issue about the UIWebView, and it has been 3 years since the first one was posted, but I just want an answer. What the specific reason why UIWebView gets referenced in the generated framework? Since some mentioned it still passes Apple's validation, I still need a specific reason why this occurs. My guess is that the UIKit is being compiled along with the project, but I'm not sure how accurate is that. Thanks to whoever is going to answer.
    l
    18 replies · 2 participants
  • d

    Digory Doolittle

    12/08/2022, 7:09 AM
    I can call a Kotlin function from C++ like this:
    libnative_symbols()->kotlin.root.ch.digorydoo.kangaroo.doSomething(42);
    Is the call to libnative_symbol() fast enough so I can do this on every call (from a C++ macro)? Or should I cache the result in a variable?
    l
    1 reply · 2 participants
  • s

    Slackbot

    12/08/2022, 1:22 PM
    This message was deleted.
    d
    1 reply · 2 participants
  • s

    simon.vergauwen

    12/09/2022, 9:05 AM
    Hey everyone, It should be possible to wrap
    /usr/bin/openssl
    and
    /usr/bin/base64
    from Kotlin Native, no? I'm trying to wrap these to generate JWT tokens. Anyone has a good example I could look at?
    e
    c
    +1
    11 replies · 4 participants
  • p

    Pablichjenkov

    12/11/2022, 12:40 AM
    What advantage or solution to specific edge case, the
    actual/expect
    feature has over regular interface/abstract class design. Perhaps not having to write down the interface 🤔
    a
    n
    +1
    13 replies · 4 participants
  • e

    Eric Womer

    12/11/2022, 9:14 AM
    Why is
    @Composable
    fun DiceRollerView() {
        LazyColumn {
            /* DO Image */
            Image(painter = painterResource(id = R.drawable.dice_1), "") // <- This Line
            /* Do Button */
        }
    }
    complaining "@Composable invocations can only happen from the context of a @Composable function"?
    n
    a
    4 replies · 3 participants
  • e

    Eric Womer

    12/11/2022, 9:24 AM
    Ok, it seems to be LazyColumn
  • e

    Eric Womer

    12/11/2022, 9:27 AM
    Yeah, just an idiot who doesn't remember how to use a LazyColumn
Powered by Linen
Title
e

Eric Womer

12/11/2022, 9:27 AM
Yeah, just an idiot who doesn't remember how to use a LazyColumn
View count: 11