https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
i

Ignat Beresnev

03/05/2023, 8:30 AM
Hi! I can't figure out if it's a bug or a feature, maybe someone with experience can help 🙂 I'm building a shared (
.dll
) library on Windows. If I build a vanilla Kotlin/Native project, the DLL exported symbols seem to be all public functions (screenshot 1). My own top-level
@CName
function is exported, I can see it. However, if I add an implementation dependency on kotlin-libui (cc @msink), DLL exported symbols are UI only (screenshot 2). My top-level
@CName
function is NOT exported, neither are any other K/N functions. Looks like the exports are taken from libui only and the rest is ignored. The
.def
and
.h
files are the same, so they contain my top-level function, but of course it fails in runtime whenever I try to load the DLL.
Copy code
kotlin {
    val nativeMain by sourceSets.getting {
        dependencies {
            implementation("com.github.msink:libui:0.1.8")
        }
    }
}
Is there a way to tell the compiler to export all public functions, or override the list? I tried multiple options (including linker ones), tried removing exports from libui and some other things - nothing helped 😞 I basically want both ui and my own top-level function to be exported.
3 Views