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

    Brian Guertin

    02/23/2022, 3:14 AM
    I'm getting a crash in my iOS app, but I have no idea what it means. No stack trace. It's coming from Kotlin native. Anyone seen this?
    OS Version:         iOS 14.6
    
    (anonymous namespace)::ExceptionObjHolderImpl: 
    
    0 unknown file unknown method
    n
    • 2
    • 1
  • w

    Wyatt Kennedy

    02/24/2022, 9:56 PM
    Question about cinterop. Can this be used to produce bindings in a shared module across many native targets? I have made a little example where I compiled a static library test.a in mingwx64 and then used cinterop in gradle to link the static file and create bindings from the header. That all works. Now let's say I have a sourceSet named nativeMain that other sourceSets like mingwX64Main depend on. How do I reference the generated bindings in that shared sourceSet? Currently I have a kotlin block in my build.gradle.kts configured like so:
    mingwX64 {
        this.compilations["main"].cinterops {
            create("test") {
                packageName = "github.fatalcatharsis.test"
                includeDirs.allHeaders(project.rootDir.resolve("headers"))
                extraOpts("-libraryPath", "${project.rootDir}/src/mingwX64Main/resources/", "-staticLibrary", "test.a")
            }
        }
    }
    
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(kotlin("stdlib-common"))
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
    
        val nativeMain by creating {
            dependsOn(commonMain)
        }
    
        val mingwX64Main by getting {
            dependsOn(nativeMain)
        }
    }
    Code that I put in src/mingwX64Main/kotlin gets highlighted properly and builds using the definitions in my c header. But nativeMain obviously does not. Is there any way to have the header bindings available to a shared source set?
    m
    • 2
    • 7
  • j

    jean

    02/25/2022, 9:53 AM
    I’m getting a report in crashlytics with this stacktrace. Crashlytics points
    kotlin::FormatToSpan(kotlin::std_support::span<char, 18446744073709551615ul>, char const*, ...) + 4354272500
    to be the culprit. I have no Idea how to find what causes this, how should I proceed?
    Untitled.txt
    m
    m
    • 3
    • 4
  • n

    Nikky

    02/25/2022, 11:18 AM
    can kotlin-native give me the name of the binary as part of the args in main.. ? i want to use clikt and give the main command the name of the binary so that error and help messages will be correct no matter what the executable was renamed to..
    b
    r
    • 3
    • 10
  • w

    Wietlol

    02/25/2022, 11:02 PM
    by default, it gives me the following build
    val hostOs = System.getProperty("os.name")
        val isMingwX64 = hostOs.startsWith("Windows")
        val nativeTarget = when {
            hostOs == "Mac OS X" -> macosX64("native")
            hostOs == "Linux" -> linuxX64("native")
            isMingwX64 -> mingwX64("native")
            else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
        }
        nativeTarget.apply {
            binaries {
                executable {
                    entryPoint = "main"
                }
            }
        }
    which works and generates a windows ".exe" file I can also change the first line to a literal
    "Linux"
    (to pretend I am on a linux) and it works and generates a linux ".kexe" file but I can't figure out how to make it generate both a linux ánd a windows executable
    ✅ 1
    e
    • 2
    • 15
  • w

    Wietlol

    02/26/2022, 12:31 AM
    Install the curl library
    however, I am a bit confused and annoyed by this step as 1, this shouldnt be necessary, developers shouldnt download and install arbitrary things just to make their machine able to build a project, this is literally what tools like gradle are meant for, why is this not handled by gradle?! 2, the link is just a download page, which gives absolutely no information as to how to "install" (pretending that even makes sense) the package 3, I have curl already "installed"
    e
    • 2
    • 18
  • t

    Tristan

    02/26/2022, 2:25 AM
    Hello, When compiling for mac (using
    ./gradlew linkNative
    ) I get an error when I return
    null
    in a function, such as:
    // commonMain
    interface GetManufacturerUseCase {
        operator fun invoke(): String?
    }
    // nativeMain
    class GetManufacturerUseCaseImpl : GetManufacturerUseCase {
        override fun invoke() = null
    }
    It produces this error
    /var/folders/v4/tsnbm2mj12qcqd5mzx022z0m0000gp/T/konan_temp15915856283221827637/api.cpp:482:21: error: unknown type name 'libNative_kref_kotlin_Nothing'; did you mean 'libNative_kref_kotlin_Long'?
                        libNative_kref_kotlin_Nothing (*invoke)(libNative_kref_com_me_myproject_deviceInfo_domain_usecase_GetManufacturerUseCaseImpl thiz);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        libNative_kref_kotlin_Long
    To fix it, I return an empty string 😕 But that’s not really what I want. Is this a bug, or a limitation?
    e
    • 2
    • 2
  • c

    Chachako

    02/27/2022, 6:01 PM
    Hello everyone, how should I interoperate with C++ in kotlin native? I need to call a library whose header file is C++, the library is a bit huge, so it is unrealistic to manually change it to a C header. In addition, I am a newbie to C/C++, so this question may be a bit stupid.
    c
    s
    m
    • 4
    • 4
  • t

    Tristan

    03/02/2022, 12:56 AM
    Hello, Is there a possibility to generate a .dylib (or .so), which uses a header file but don’t include the library? I would like to compile a .dylib that will be used by Unity Engine. So I’ll be using the header file, but not it’s implementation, which will be provided by Unity.
    b
    m
    • 3
    • 9
  • m

    Mateusz Apacki

    03/02/2022, 7:38 AM
    Hi, It is any possibility to do Parameterized Tests in kotlin-test?
    g
    • 2
    • 3
  • r

    ribesg

    03/02/2022, 10:32 AM
    I have a Kotlin app with some cocoapods dependencies, I have a
    cocoapods
    block in my gradle build file. It generates a podspec file. I then reference this podspec file from the Podfile of an XCode project. Now, in a Swift file in the XCode project, I seem to be able to import the dependencies of my app defined in my
    cocoapods
    block, but not my own Kotlin code. Anyone knows how this is supposed to work?
    ✅ 1
    d
    • 2
    • 3
  • w

    Wietlol

    03/03/2022, 2:03 AM
    did anyone manage to compile a Kotlin Native project for linux in a docker container? in my case, the build just keeps failing currently, the error looks like "idunno, something didnt work" to me, so I have no idea how to even approach this
    r
    e
    • 3
    • 5
  • r

    ribesg

    03/03/2022, 10:15 AM
    Is there a simple way to pass a Swift
    [String]
    to a Kotlin function taking an
    Array<String>
    (exposed to Swift as
    KotlinArray<NSString>
    )?
    s
    • 2
    • 4
  • d

    Dragos Rachieru

    03/07/2022, 2:01 PM
    Hello, I created a
    sourceSet
    called
    desktopMain
    like in this example The problem I'm facing, is that
    platform.posix.popen
    and
    platform.posix.pclose
    are not available in the shared
    sourceSet
    . Any idea why it is not resolved?
    m
    • 2
    • 5
  • f

    Francesco Pedron

    03/07/2022, 4:48 PM
    Hello, I'm proceeding with my tests using kotlin/native to interact with a DLL on Windows (see thread https://kotlinlang.slack.com/archives/C3SGXARS6/p1642088820036200 and repo https://github.com/francescopedronomnys/kotlin-native-libcurl-dll). I was able to get it working with curl (as libcurl.dll) and I'm now trying to communicate with a different DLL (named libusbtocan.dll), so I've done what it looks like the same configuration on a new project (see the repo https://github.com/francescopedronomnys/kotlin-native-usb2can-dll ) but I cannot get it to compile, this is the error I get:
    The C:\Users\Francesco\.konan\dependencies\llvm-11.1.0-windows-x64-essentials/bin/clang++ command returned non-zero exit code: 1.
    output:
    lld-link: error: undefined symbol: CanalGetDllVersion
    >>> referenced by Z:\BuildAgent\work\6326934d18cfe24e\kotlin\libraries\stdlib\src\kotlin\util\Result.kt:0
    >>>               C:\Users\FRANCE~1\AppData\Local\Temp\konan_temp5544792713254776830\result.o:(libusbtocan_CanalGetDllVersion_wrapper14)
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    
    FAILURE: Build failed with an exception.
    Idea is able to resolve libusbtocan methods, so it looks like the linker (?) should be able to resolve that symbol. Do you have any hint? Thanks.
    m
    • 2
    • 2
  • l

    Landry Norris

    03/07/2022, 5:44 PM
    For a project I was evaluating starting in Kotlin/Native, I need to compile for targets outside of what K/N currently supports (currently freestanding with no OS). I can handle the LLVM args and cinterop myself, but I was wondering if there's a problem with setting the target to linuxX64 and overriding the clang-args. It looks like K/N needs a cxxabi binary, so I'll have to compile one freestanding and link that. Has anyone else tried this? If I expand to other architectures, such as RISC-V, can I keep the target linuxX64 and override the arch with clang-args?
    n
    • 2
    • 9
  • n

    napperley

    03/08/2022, 12:58 AM
    Encountering an issue where there are some dependency conflicts after running the linkCounterDebugExecutableLinuxX64 Gradle task. Below is the truncated version of the build log:
    e: Module "io.gitlab.embed-soft:lvglkt-sdl2 (io.gitlab.embed-soft:lvglkt-sdl2-linuxx64)" has a reference to symbol lvgl/lv_tick_inc|-852571541272050155[100]. Neither the module itself nor its dependencies contain such declaration.
    
    This could happen if the required dependency is missing in the project. Or if there is a dependency of "io.gitlab.embed-soft:lvglkt-sdl2 (io.gitlab.embed-soft:lvglkt-sdl2-linuxx64)" that has a different version in the project than the version that "io.gitlab.embed-soft:lvglkt-sdl2 (io.gitlab.embed-soft:lvglkt-sdl2-linuxx64): 0.3.0" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies.
    
    The list of "io.gitlab.embed-soft:lvglkt-sdl2 (io.gitlab.embed-soft:lvglkt-sdl2-linuxx64): 0.3.0" dependencies that may lead to conflicts:
    1. "io.gitlab.embed-soft:lvglkt-core (io.gitlab.embed-soft:lvglkt-core-linuxx64): 0.3.0" (was initially compiled with "io.gitlab.embed-soft:lvglkt-core (io.gitlab.embed-soft:lvglkt-core-linuxx64): 0.2.0")
    2. "io.gitlab.embed-soft:lvglkt-drivers (io.gitlab.embed-soft:lvglkt-drivers-linuxx64): 0.3.0" (was initially compiled with "io.gitlab.embed-soft:lvglkt-drivers (io.gitlab.embed-soft:lvglkt-drivers-linuxx64): 0.2.0")
    Tried to resolve the issue by clearing out the local Maven repository cache (in ~/.m2/repository), republishing the libraries, and rebuilding the Linux X64 binary however the same issue occurs. I'm wondering if the sample project referencing two Maven repositories (Maven Central & Maven Local) could cause this issue. @Artyom Degtyarev [JB]
    • 1
    • 2
  • j

    Jon Bailey

    03/08/2022, 1:28 PM
    Hey all, I’m using
    ./gradlew :shared:embedAndSignAppleFrameworkForXcode
    in a run script build phase in Xcode. Is there a way to change the output format of the errors from kotlin compiler (or gradle?) so that they show up as errors in Xcode? Currently I’m using sed like this:
    ./gradlew :shared:embedAndSignAppleFrameworkForXcode 2> >(sed 's_^e: \([^:]*\): (\([0-9]*\), \([0-9]*\)): \(.*\)_&\n\1:\2:\3: error: \4_g' >&1)
    which is a bit ugly but works. It seems like there should be a way to tell the kotlin compiler/gradle directly what format to use?
    r
    • 2
    • 1
  • j

    Joaquim

    03/10/2022, 7:00 AM
    Has anyone had success running k/n code from python? Trying to find the right approach between CPython extension, ctypes or something else. Curious if anyone has some experiences to share
    b
    • 2
    • 2
  • t

    theapache64

    03/13/2022, 8:07 AM
    Rookie here 👋
    readln
    fails in IDE but works in terminal. Any idea how I can fix this? 🤔
    readln_fails.mp4
    e
    • 2
    • 2
  • l

    Landry Norris

    03/14/2022, 8:36 PM
    I’m currently trying to use Storyboards with KMM. I’m aware that I can’t attach my Kotlin ViewController to the storyboard, so I’m trying to load the storyboard using
    UIStoryboard.storyboardWithName(storyboardName, null).instantiateInitialViewController()
    and calling view.addSubview on the main view of the resulting ViewController in my Kotlin ViewController. This works fine, and I’ve set up nice extension functions for this, but I’m seeing that the Safe Area is ignored. I set up rotation lately, reloading the storyboard on device rotation, and I noticed that the Safe Area works this time. Has anyone tried something similar and run into the same issues?
    s
    • 2
    • 9
  • r

    Raed Ghazal

    03/15/2022, 6:14 PM
    Hi how can I annotate the class used in an Extension function and not the returned type of this function e.g.
    @ColorRes, @ColorInt
    fun Int.doSomthing(): Int {
    return getColor(this)
    }
    so the extension function is for @ColorRes Int, and the return type is @ColorInt if I annotate the function with @ColorRes it will take it as a return type annotation but I can’t seem to find how to annotate the main class the extension is made of
    m
    n
    • 3
    • 5
  • s

    Sam

    03/16/2022, 4:44 PM
    Is anyone else experiencing the Xcode 13.3 debugger just hanging when hitting a breakpoint? My setup is a Swift app -> Kotlin (1.5.31) Framework using the
    embedAndSignAppleFrameworkForXcode
    task. I’m trying to break on a line in a Swift file. It’s always a little slow to initialize the debugger when hitting a breakpoint in a Swift file. In the newest Xcode it just spins forever. Loading up a copy of Xcode 13.1 still works.
    r
    m
    • 3
    • 8
  • l

    Landry Norris

    03/17/2022, 7:50 PM
    I updated a C library I’m using with a K/N project, and a few variables now have the following when I check the type using IDEA:
    CPointer<[ERROR : Unknown type parameter 0. Please try recompiling module containing "[container not found]"]>
    . I know that the types are AVStream, and that AVStream is recognized by Kotlin. This seems to occur when using the get(index) extension provided by the cinterop package. Has anyone run into this issue before? [Fixed by downgrading Kotlin from 1.6.20-RC to 1.6.10]
    • 1
    • 2
  • r

    russhwolf

    03/17/2022, 10:00 PM
    Does anyone use the cocoapods plugin with groovy gradle scripts? I'm trying to check the compatibility of some other code with groovy scripts, and realizing that I can't even get the cocoapods plugin working. When I call the
    framework
    block like
    kotlin {
      cocoapods {
        framework {
          ...
        }
      }
    }
    I get an ambiguous method overload error. Looking at the tests in the kotlin native repo, I don't see anything that calls
    framework
    so maybe it's a bug.
    • 1
    • 2
  • n

    Nikky

    03/21/2022, 12:14 PM
    is there currently any solution/approach to bundle files/binary data into kotlin-native executables so i can avoid having to distribute them in a zip file or such ?
    👀 1
    b
    n
    e
    • 4
    • 15
  • m

    mkrussel

    03/23/2022, 3:26 PM
    Where can I find the documentation for the
    .def
    files used for
    cinterop
    ? I can find examples but nothing that lists all the properties and what they can have as values.
    h
    • 2
    • 2
  • l

    Leon Kiefer

    03/29/2022, 11:41 AM
    We need to implement a funtion in kotlin with the following signature
    fun foo(args: List<*>)
    the args list contains many different types of arguments (Strings, Int, Bool, Callbacks). This function foo is called from Native code on ios. If a Callback(function pointer in native code) is part of the args list, kotlin converts it to a Double and we don't know how to call it in kotlin. The args parameter is very generic, because this is part of a framework integration project, which also uses code generation and so we have to handle the dynamic list of parameters at runtime.
    a
    • 2
    • 3
  • l

    Landry Norris

    03/31/2022, 9:15 PM
    If I return from inside a memScoped lambda, does that leak anything I’ve allocated? I would assume that return@memScoped would work fine, but I’m not sure about returning from the function.
    t
    • 2
    • 3
  • a

    Alexandre Brown

    04/01/2022, 7:29 PM
    Hello, I'm new to native, is it possible to use a c++ library from kotlin ? Use case : Multiplatform kotlin library that targets native would be able to use existing c++ library in its native code definition (since most Kotlin Multiplatform library are JVM or JS only)
    b
    • 2
    • 12
Powered by Linen
Title
a

Alexandre Brown

04/01/2022, 7:29 PM
Hello, I'm new to native, is it possible to use a c++ library from kotlin ? Use case : Multiplatform kotlin library that targets native would be able to use existing c++ library in its native code definition (since most Kotlin Multiplatform library are JVM or JS only)
b

Big Chungus

04/01/2022, 7:35 PM
Only via C. Direct cpp interop is postponed
a

Alexandre Brown

04/01/2022, 7:37 PM
In general is it the recommended approach (to use C interop and try to call c libs)? Or is it better to look for ways the users of your kotlin multiplatform lib could call the JS target instead of native ? Native seems to be still relatively new in the ecosystem, not a lot of KMP seem to offer it
From my understanding this means that if you want to call a c++ lib then trying to adapt your lib users to use the JS target might be your only option.
b

Big Chungus

04/01/2022, 7:39 PM
Not sure how cpp relates to js, sorry 😀
a

Alexandre Brown

04/01/2022, 7:40 PM
What I'm saying is maybe if your library users are c++ apps, then maybe it's better to ditch native and target JS (Assuming c++ can call JS). Would have to double check but pretty sure c++ can call JS
b

Big Chungus

04/01/2022, 7:41 PM
But kotlin really cares only about the headers. Some cpp issues provide c headers so see if your lib has that
a

Alexandre Brown

04/01/2022, 7:41 PM
Ok thanks
b

Big Chungus

04/01/2022, 7:41 PM
Even if cpp can call js, that would be a significant performance hit and as such I'd personally try to avoid it.
a

Alexandre Brown

04/01/2022, 7:42 PM
Yes for sure, but at least that'd be a solution to start off with.
b

Big Chungus

04/01/2022, 8:06 PM
I think writing your own C layer to interop between the two would be a better way to go
a

Alexandre Brown

04/01/2022, 8:07 PM
Interesting idea, I would need to define C headers for the kotlin lib and call my c++ lib from
.c
files?
b

Big Chungus

04/01/2022, 8:08 PM
Something like that. I've never actually done it myself, just an idea.
👍 1
View count: 14