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

    bmsantos

    08/28/2017, 1:21 PM
    Noticed that there's an effort to have Kotlin WebAssembly compilation. Is this available in the latest release?
    o
    • 2
    • 1
  • f

    fabianterhorst

    08/29/2017, 10:03 PM
    is there an sample somewhere how to compile an kotlin native static library and link it to cpp
    o
    • 2
    • 1
  • j

    jondotan

    08/30/2017, 5:36 PM
    i'm trying to understand the delta between Kotlin Native and Scala Native. After trying both I get the feeling Kotlin is going for a pragmatic approach with language support but not necessarily std lib and JVM libs, by which it is minimal close-to-metal (binaries are around 400kb), and Scala is going for 1:1 match between JVM and native (binaries are around 4.4mb).
    o
    • 2
    • 1
  • j

    jondotan

    08/31/2017, 11:15 AM
    cross-compilation and fast start up time are the two killer differentiators
    👍 1
    n
    • 2
    • 1
  • t

    tunedal

    08/31/2017, 3:19 PM
    Will the Objective-C reference-counting be integrated with the Kotlin/Native reference-counting somehow? (Perhaps via the recently added finalizer support?)
    s
    • 2
    • 3
  • a

    agrosner

    08/31/2017, 5:24 PM
    that would be interesting in practice with cross platform kotlin modules. simple reference cycles can trip up expert java devs when going to ARC
    s
    o
    • 3
    • 5
  • h

    harmony

    09/01/2017, 1:49 AM
    any gui stuff for kotlin native?
    n
    • 2
    • 1
  • r

    redrield

    09/01/2017, 2:23 AM
    Is there Kotlin --> C, C++, Rust etc interop?
    o
    • 2
    • 1
  • r

    redrield

    09/01/2017, 2:24 AM
    Would I be able to define a top level function in kotlin native, compile it as a library, and call that function from some other programming language?
    o
    • 2
    • 1
  • a

    andreasmattsson

    09/01/2017, 8:26 AM
    Any coroutine-gurus here than can help? I've wrapped a C-library method, that feeds values to a callback, in a kotlin method to capture the results (callback will be called multiple times) in a lambda. Basically called like this:
    library.invoke(arg) { value -> doSomething(value) }
    Now what I'd like to do is wrap this somehow so that instead of using a callback my wrapping method returns a Sequence (going from a push to a pull style API). My first attempt was to use buildSequence:
    buildSequence { library.invoke(arg) { value -> yield(value) } }
    But this gives
    Suspension functions can be called only within coroutine body
    . The Wrapping callbacks section in the documentation here looked promising: https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md#wrapping-callbacks But as far as I can tell this
    suspendCoroutine
    trick only works if the callback is called only once by the library. Mine is called many many times, and I want to have a sequence where I can consume items one by one and not have to gather them in a list first. Channels looks like a good approach but AFAIK they are only available in the
    kotlinx.coroutines
    package that does not work in Kotlin Native. Any suggestions? Are there any "out of the box" or idiomatic solutions for this that don't involve manually implementing a producer/consumer pattern using C/threading concurrency stuff?
    o
    • 2
    • 2
  • a

    andreasmattsson

    09/04/2017, 12:46 PM
    I'm trying to use the Workers API but getting a "Memory leaks found" as soon as I try to pass worker arguments:
    C:\Users\w64vm\kotlin-native\runtime\src\main\cpp\Memory.cpp:751: runtime assert: Memory leaks found
    No args, no errors:
    data class WorkerArgs(val unused: Unit = Unit)
    val worker = startWorker()
    val future = worker.schedule(
            TransferMode.CHECKED,
            { },
            { }
    )
    future.consume { _ -> }
    worker.requestTermination().consume { _ ->  }
    With args, prints error:
    data class WorkerArgs(val unused: Unit = Unit)
    val worker = startWorker()
    val future = worker.schedule(
            TransferMode.CHECKED,
            { WorkerArgs() }, // <-- this line
            { }
    )
    future.consume { _ -> }
    worker.requestTermination().consume { _ ->  }
    Do I need to manually dispose the WorkerArgs instance somehow?
    o
    • 2
    • 1
  • n

    nimtiazm

    09/09/2017, 1:00 PM
    currently, kn macosx doesn’t cross-compile to linux/arm64. will this be fixed anytime soon?
    o
    • 2
    • 1
  • n

    nimtiazm

    09/09/2017, 1:01 PM
    actually that’s my ease with golang. i’ve been trying to migrate my use-cases from go to kn. so far ide support and osx to linux cross-compilation is the biggest pain with kn
    o
    • 2
    • 1
  • c

    claudiug

    09/17/2017, 10:01 AM
    better to ask here. There is any roadmap for kotlin-native?
    o
    • 2
    • 1
  • r

    redrield

    09/17/2017, 9:59 PM
    How/What do people use atm to write K/N? Considering IntelliJ doesn't play nice with konan last I checked
    m
    n
    +3
    • 6
    • 7
  • a

    andreasmattsson

    09/18/2017, 9:16 AM
    I'm using the
    konan.worker.*
    APIs to do some background processing (in a loop), and it's working well, but now I'd like to add an ability to gracefully cancel/abort (early-exit) from the background loop. What's the correct way to implement this? Is there some flag I can check for in my background loop that is set when
    requestTermination
    has been called? I understand there are restrictions on sharing state, so for example I get an
    IllegalStateException
    if I try to pass in a
    BooleanVar
    into my worker args.
    o
    • 2
    • 3
  • j

    jkbbwr

    09/18/2017, 9:22 AM
    Still hoping and waiting on that kotlin from C interop
    o
    • 2
    • 4
  • b

    benleggiero

    09/19/2017, 10:18 AM
    Is there any way to do 2 things at once without JVM/JS? I was hoping to use coroutines or threads
    a
    o
    +2
    • 5
    • 12
  • j

    jkbbwr

    09/20/2017, 4:35 PM
    @benleggiero Btw, coroutines don't actually do two things at once, they just fake it
    b
    • 2
    • 1
  • a

    andreasmattsson

    09/21/2017, 8:23 AM
    Okay, and I can't get around that by managing the memory for those objects myself? (e.g. in the snippet above I attempted to
    alloc
    a long on the heap)
    o
    • 2
    • 3
  • t

    tunedal

    09/24/2017, 5:00 PM
    How come
    "hello".cstr.size == "hello".length + 2
    ? Shouldn't it just have one more byte for the NUL?
    o
    • 2
    • 2
  • a

    ariff

    09/25/2017, 11:46 PM
    Hi, I am doing a pet project, where I would like to compile kotlin native to web assembly through llvm. Is there a tutorial, or steps I can follow ? Searched google but couldn't find a good workaround.
    n
    o
    • 3
    • 3
  • a

    alexcouch

    09/26/2017, 11:00 PM
    How would memory management work with the native compiler? Is there gonna be a way manage memory with native kotlin or is it all done by the compiler like most high level languages? Will there be pointers like in Go and C++ or will it all be inferred by your code structure?
    a
    o
    • 3
    • 3
  • h

    harmony

    09/29/2017, 1:04 AM
    kotlin native still has garbage collection right?
    g
    e
    +2
    • 5
    • 6
  • f

    Francis

    09/29/2017, 12:32 PM
    hey, starting up with kotlin+native, I'm looking at the native+gtk example to start a project. It fails using only
    build.sh
    but it work with
    gradlew
    . So my question is: Is gradle required to build native (doc say
    build.sh
    should do) or I'm doing something wrong?
    o
    s
    • 3
    • 6
  • f

    fab

    10/03/2017, 10:00 AM
    Hi, I just started to develop a (toy) wrapper for ArrayFire to see how far I can get. I am new to kotlin native and got into trouble with the memory management. ArrayFire has its own reference counting and I do need to call a hook if a wrapper class instance gets freed. I have seen some solutions with an RAII like approach but I would like to try something like a destructor / finalizer. Sorry If i missed something in the examples or the docs but I did not find a solution yet. Any Ideas how I could approach this?
    o
    t
    • 3
    • 2
  • a

    aaverin

    10/03/2017, 11:13 AM
    Anybody tried to run Kotlin Native with iOS already? Any limitations known already?
    o
    • 2
    • 3
  • a

    agrosner

    10/03/2017, 2:08 PM
    Kotlin native for iOS should compile to a framework/library project for iOS targets so that any iOS developer can just use it and build their apps with swift if they need be
    o
    • 2
    • 8
  • n

    napperley

    10/08/2017, 2:30 AM
    Are there any other cross platform GUI toolkits with a C API (except for GTK where Kotlin Native already has a sample)?
    o
    h
    • 3
    • 2
  • h

    harmony

    10/08/2017, 2:52 AM
    https://github.com/andlabs/libui https://github.com/Extrawurst/cimgui https://github.com/filcuc/DOtherSide
    👍 1
    n
    t
    +4
    • 7
    • 13
Powered by Linen
Title
h

harmony

10/08/2017, 2:52 AM
https://github.com/andlabs/libui https://github.com/Extrawurst/cimgui https://github.com/filcuc/DOtherSide
👍 1
n

napperley

10/08/2017, 6:33 AM
DOtherSide only covers a view DSL (QT QML), not a GUI toolkit.
t

tunedal

10/08/2017, 10:43 AM
There is also IUP which seems similar to libui but more mature: http://webserver2.tecgraf.puc-rio.br/iup/
Or, if you don't care about native platform widgets, the Enlightenment Foundation Libraries: https://www.enlightenment.org/about-efl
m

msink

10/08/2017, 11:12 AM
IUC does not target OSX, so is not cross-platform - for modern desktops it means at least Windows/Linux/Mac
t

tunedal

10/08/2017, 11:42 AM
I'm actually considering SWT for a project I'm about to start, i.e. native widgets wrapped in a Java API (with Kotlin/JVM). It seems all the C-based libraries are either incomplete/immature or lacking in platform support.
s

sksk

10/08/2017, 12:05 PM
https://github.com/vurtun/nuklear
m

msink

10/08/2017, 12:35 PM
SWT is possible variant - and I even tried convert it to pure Koylin, two months ago. Not finished - too many work for single man hobby project - but it is definitely possible.
e

elect

10/08/2017, 8:55 PM
if interested I ported imgui to kotlin, https://github.com/kotlin-graphics/imgui
n

napperley

10/08/2017, 10:57 PM
Gluseppe - That port is for Kotlin JVM, not Kotlin Native.
Nuklear is on the right path (cross platform, high performance, descent aesthetics, reasonable number of maintainers) but has poor docs, and isn't well designed. Just look at the ENORMOUS header file ( WARNING, large file size - https://github.com/vurtun/nuklear/blob/master/nuklear.h ) that contains both definitions and source code! 😱
e

elect

10/09/2017, 7:50 AM
Yeah, but I thought you may find interesting anyway
s

sksk

10/09/2017, 9:15 PM
one header file is the intended behavior, they want it be portable and easy to include in your project
r

rwachol

10/10/2017, 3:32 PM
libui is pretty nice, hope more people would make PRs so in future it will be more feature-complete
View count: 4